TravelModellingGroup / TMGToolbox

Python tools for INRO Inc.'s Emme software
GNU General Public License v3.0
34 stars 17 forks source link

Import Network Package - format error when importing transit lines #62

Closed malamillo closed 3 years ago

malamillo commented 3 years ago

Hi all,

Is it possible to add a feature to the 'Import Network Package' to deal with issue of importing transit lines names from NWP files created using the previous TMG toolbox and EMME 4.3 (< TMGToolbox-dev-1.8)?

For example, the line header for line M009Aa below:

a'M009Aa' b 17 22.50 24.02 Rathburn-Miller's A 20 0 0

Gives the following formatting error:

Traceback (most recent call last):
  File "C:\GGHM\Program\TMGToolbox-dev-1.8\TMGToolbox\src\input_output\import_network_package.py", line 463, in run
    self._execute()
  File "C:\GGHM\Program\TMGToolbox-dev-1.8\TMGToolbox\src\input_output\import_network_package.py", line 519, in _execute
    self._batchin_lines(scenario, temp_folder, zf)
  File "inro\director\logging\trail.py", line 271, in __trace
  File "C:\GGHM\Program\TMGToolbox-dev-1.8\TMGToolbox\src\input_output\import_network_package.py", line 581, in _batchin_lines
    scenario=scenario)
  File "C:\GGHM\Program\TMGToolbox-dev-1.8\TMGToolbox\src\common\utilities.py", line 740, in runTool
    ret = self._activeTool(*args, **kwargs)
  File "inro\director\logging\trail.py", line 271, in __trace
  File "standard\inro\emme\data\network\transit\transit_line_transaction.py", line 172, in __call__
  File "inro\emme\procedure\__init__.py", line 141, in run
  File "inro\emme\procedure\transaction.py", line 59, in _run
  File "inro\emme\procedure\transaction.py", line 268, in _handle_record_error
Error: Record 32095: Format error

A solution is to directly edit the transit lines files themselves to remove the ' characters from the transit line names, but when you have several files, that makes it more challenging.

Regards.

lunaxi7 commented 3 years ago

Hello @malamillo , please pull the latest commit for dev-1.8, which should solve this issue. Kindly let us know if this works for you.

malamillo commented 3 years ago

@lunaxi7 thank you. I've tried the new toolbox version and it works for me.

If there's a script or code to patch nwp files where there are empty transit line names I'd be interested in that.

lunaxi7 commented 3 years ago

This issue has been solved. Other questions will be communicated via emails or a new issue will be opened if needed.