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

[BUG] Fixing frequent Python errors when using operations. #323

Open
emmambd opened this issue Jan 17, 2024 · 2 comments
Open

[BUG] Fixing frequent Python errors when using operations. #323

emmambd opened this issue Jan 17, 2024 · 2 comments

Comments

@emmambd
Copy link
Contributor

emmambd commented Jan 17, 2024

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:

  1. Use internal Linux virtual machine (MobilityData specific step)
  2. Follow Installation instructions up to and including source env/bin/activate
  3. Run from tools.operations import *
  4. 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 *

@a-albashir
Copy link

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.

@emmambd
Copy link
Contributor Author

emmambd commented Apr 23, 2024

@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?

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

2 participants