Splines / deutsche-bahn-analysis

🚆 Analysis of delays of the Deutsche Bahn (DB)
7 stars 0 forks source link

Error on Decompress Script #1

Closed druckgott closed 1 year ago

druckgott commented 1 year ago

Error with: Traceback (most recent call last): File "f:\Python\deutsche-bahn-analysis-main\src\util\decompress.py", line 10, in with open(os.path.join('./download', filename), 'rb') as f: PermissionError: [Errno 13] Permission denied: './download\8001354'

Can you help me? I´m on windows

Splines commented 1 year ago

It seems that there is a problem with the file permission. You might want to check that your current user has enough rights, e.g. see here. Can you rename the file in the windows explorer and try to execute the decompression script again?

druckgott commented 1 year ago

I have taken a look. I update but I get the error again but if I add a output I think it´s not taking the file it take a folder.

grafik

I added a Printout: print(os.path.join('./download', filename))

(.venv) F:\Python\deutsche-bahn-analysis-main>f:/Python/deutsche-bahn-analysis-main/.venv/Scripts/python.exe f:/Python/deutsche-bahn-analysis-main/src/util/decompress.py
./download\8001354
Traceback (most recent call last):
  File "f:\Python\deutsche-bahn-analysis-main\src\util\decompress.py", line 11, in <module>
    with open(os.path.join('./download', filename), 'rb') as f:
PermissionError: [Errno 13] Permission denied: './download\\8001354'
Splines commented 1 year ago

Ah that's what you mean, I've updated the script accordingly, so that it only considers files not folders anymore. If you want to decompress a subfolder in downloads (semantically meaning the downloads for a specific station), you need to change the base_path now.

druckgott commented 1 year ago

Ok now I get no error. How do I know that the main script works? I have someting in the uncompressed folger but only with 1k and if I run the decompress I get nothing in the decompressed folder. I have the feeling the Main script runs, but did not do what it sould do. Log says this:

1685717605.851424;2023-06-02 16:53:25;INFO;main.py;33;Start script called
1685717605.853423;2023-06-02 16:53:25;INFO;bahn.py;124;Station eva numbers are: { '8005626', '8005628'}
1685717605.853423;2023-06-02 16:53:25;INFO;bahn.py;126;Validate station folders
1685717640.857780;2023-06-02 16:54:00;INFO;bahn.py;135;Started bahn.py execution
1685717641.343157;2023-06-02 16:54:01;INFO;bahn.py;51;Calling endpoint: plan/8005626
1685717641.474792;2023-06-02 16:54:01;INFO;bahn.py;60;Calling endpoint: fchg/8005626
1685717641.606364;2023-06-02 16:54:01;INFO;bahn.py;51;Calling endpoint: plan/8005628
1685717641.722242;2023-06-02 16:54:01;INFO;bahn.py;60;Calling endpoint: fchg/8005628
Splines commented 1 year ago

1K as file size is perfectly fine and the log looks fine too, it called the respective endpoints. As I said, you will probably want to run the decompress script with base_path = ./download/8005626 and then with base_path = ./download/8005628 as these are the two stations you want to get data for.

The whole project is still a work a progress (though currently under no active development) and a lot of things are probably not conveniently set up for users tinkering with this repo for the first time. That you have to change the base_path manually is a good example for this. In the current state, think of this repo rather as a starting point for your own project than of a complete finalized product that "just runs". Happy coding ;)