Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struggle to run example from documentation #405

Open
SergeyAnufriev opened this issue Mar 6, 2024 · 2 comments
Open

struggle to run example from documentation #405

SergeyAnufriev opened this issue Mar 6, 2024 · 2 comments

Comments

@SergeyAnufriev
Copy link

code:

import r5py
import r5py.sampledata.helsinki

transport_network = r5py.TransportNetwork(
r5py.sampledata.helsinki.osm_pbf,
[r5py.sampledata.helsinki.gtfs],
)

output:

C:\Users\anufr\miniconda3\envs\r5py\python.exe C:\Users\anufr\PycharmProjects\data_generation\hello_world.py
Traceback (most recent call last):
File "OSM.java", line 207, in com.conveyal.osmlib.OSM.readFromFile
java.io.java.io.FileNotFoundException: java.io.FileNotFoundException: C:\Users\anufr\AppData\Local\Temp\r5py31qtocm0\TransportNetwork_1a6352887a0_0087ca0\data_generation (Access is denied)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "OSM.java", line 207, in com.conveyal.osmlib.OSM.readFromFile
java.lang.java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\anufr\AppData\Local\Temp\r5py31qtocm0\TransportNetwork_1a6352887a0_0087ca0\data_generation (Access is denied)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "OSM.java", line 210, in com.conveyal.osmlib.OSM.readFromFile
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\anufr\PycharmProjects\data_generation\hello_world.py", line 4, in
transport_network = r5py.TransportNetwork(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\anufr\miniconda3\envs\r5py\Lib\site-packages\r5py\r5\transport_network.py", line 62, in init
osm_file.readFromFile(f"{osm_pbf}")
java.lang.java.lang.RuntimeException: java.lang.RuntimeException: Error occurred while parsing OSM file C:\Users\anufr\AppData\Local\Temp\r5py31qtocm0\TransportNetwork_1a6352887a0_0087ca0\data_generation
Exception ignored in: <function TransportNetwork.del at 0x000001A6355F6480>
Traceback (most recent call last):
File "C:\Users\anufr\miniconda3\envs\r5py\Lib\site-packages\r5py\r5\transport_network.py", line 101, in del
self.osm_file.close()
^^^^^^^^^^^^^
AttributeError: 'TransportNetwork' object has no attribute 'osm_file'

Process finished with exit code 1

@dankdipper
Copy link

I've found this to be an issue with the provided sample data - the cached path doesn't seem to be stored in the SampleDataSet directly when the sample data module is initially imported. Using r5py.sampledata.helsinki.osm_pbf.cached_path and similar works as a workaround though.

@christophfink
Copy link
Member

Thanks for this bug report. This should have been fixed in PR #410 and will work in the next release. In the meantime, using trunk r5py (install with pip install git+https://github.com/r5py/r5py.git) is a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants