mobility-database-catalogs icon indicating copy to clipboard operation
mobility-database-catalogs copied to clipboard

[BUG] Fixing frequent Python errors when using operations.

Open emmambd opened this issue 1 year ago • 2 comments

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 *

emmambd avatar Jan 17 '24 20:01 emmambd

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 avatar Apr 23 '24 11:04 a-albashir

@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 avatar Apr 23 '24 13:04 emmambd

@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

mil avatar Oct 10 '24 21:10 mil

Fixed by #524

davidgamez avatar Oct 15 '24 18:10 davidgamez