mobility-database-catalogs
mobility-database-catalogs copied to clipboard
[BUG] Fixing frequent Python errors when using operations.
Describe the bug I get the following recurring bugs when I follow the steps in Installation and Adding feeds
To Reproduce Steps to reproduce the behavior:
- Use internal Linux virtual machine (MobilityData specific step)
- Follow Installation instructions up to and including
source env/bin/activate
- Run
from tools.operations import *
- Get:
ModuleNotFoundError: No module named 'gtfs_kit'
If I rerun the pip install -r requirements.txt
command outside the Python VM, then rerun from tools.operations import *
I get a new error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 3131: invalid start byte
Expected behavior
No error returned after from tools.operations import *
Hello,
I was countering the same issue but it seems changing the opening statement in the tools/representations.py
solved the problem.
Specifically, you can replace the line 91 in that script which now is
with open(os.path.join(path, file)) as fp:
To
with open(os.path.join(path, file), encoding='utf-8') as fp:
This solved the problem for me as it avoiding the UnicodeDecodeError
by indicate the correct encoding format.
@a-albashir Thank you for troubleshooting this and suggesting this modification!
Would it be possible for you to contribute this fix as a PR so the community can benefit?
@emmambd wonder if you can try with https://github.com/MobilityData/mobility-database-catalogs/pull/524
I was having errors similar to what you describe due to a root issue with pandas/numpy version conflicts prior to making the mentioned change
Fixed by #524