Skip to content

datacheck.sh: AttributeError: 'ConnectedRoute' object has no attribute 'mileage' #394

Closed

Description

@michihdeu

I forgot to remove the abbrev. column for two lines when copying the lines from csv to _con.csv file: TravelMapping/HighwayData@c97f37a

The datacheck.sh output was:

[164.8] Writing highway data stats log file (highwaydatastats.log).
Traceback (most recent call last):
  File "./siteupdate.py", line 3376, in <module>
    hdstatsfile.write(cr.readable_name() + ": " + "{0:.2f}".format(cr.mileage) + " mi")
AttributeError: 'ConnectedRoute' object has no attribute 'mileage'
Sat Jan  2 15:45:33 EST 2021
datacheck.sh: complete

I got NO additional info above (where the system is processed) and had to look up the whole csv file in a spreadsheet application.


I had a similar error in the past but got more detailed info above (I think it was something like "no connected route found for xxx" and could check the line before and found the error).
TravelMapping/HighwayData@fbf64b2 + TravelMapping/HighwayData@8c1672b


  1. Why does the error text refer to a 'mileage' attribute? There is nothing like that in the csv files. Can we output a better error message?
  2. Why was there no additional detailed info today - but 6 and 14 days ago?
  3. Is it possible to output the additional detailed info - if there is one - at the end before the data verification is aborted?

Activity

  1. yakra commented on Jan 3, 2021

    @yakra
    Contributor
    1. This error message isn't one we intentionally designed to output. It's is not from siteupdate.py itself, but rather python3, which barfs upon trying to access an attribute of the variable that does not exist. (Due to the nature of C++ and Python's different type systems, this error can not exist in the C++ version). IOW, there's a bug somewhere.

    2. I had a similar error in the past but got more detailed info above (I think it was something like "no connected route found for xxx" and could check the line before and found the error).
      TravelMapping/HighwayData@fbf64b2 + TravelMapping/HighwayData@8c1672b

      This deals with ConnectedRoute CSVs but is an unrelated error. (On second thought, probably related. We should not have a partially constructed ConnectedRoute object making it past this part of siteupdate to the hdstatsfile phase.) Then, siteupdate itself reported an invalid number of fields in a CSV line:

      el.add_error("Could not parse " + system.systemname + "_con.csv line: [" + line +
      "], expected 5 fields, found " + str(len(fields)))

      Now, siteupdate expects an attribute to be attached to a specific variable that isn't.

    3. Right now no, since siteupdate.py crashes before we can get that far. Other than that, I can't give a meaningful yes/no answer. Once the underlying bug is fixed, there will hopefully no longer be anything to output at that point.

    Whatever's going on, it's probably my bad.

    @michihdeu, were you running datacheck.sh on noreaster, or a different system?

  2. michihdeu commented on Jan 3, 2021

    @michihdeu
    ContributorAuthor

    noreaster

  3. yakra commented on Jan 3, 2021

    @yakra
    Contributor

    @michihdeu wrote:

    TravelMapping/HighwayData@fbf64b2 + TravelMapping/HighwayData@8c1672b

    Thanks for this info. I was able to load up the parent commit for each and reproduce the problem on lab1.

    I had a similar error in the past but got more detailed info above (I think it was something like "no connected route found for xxx" and could check the line before and found the error).

    I see ERROR: Could not parse frabfcd71_con.csv line: [frabfcd71;D182;-71;;Dulphey;frabfc.d018271], expected 5 fields, found 6 (TravelMapping/HighwayData@90b185f) inline in siteupdate.log. As noted, we don't make it to the point of aborting due to ErrorList errors & seeing it again.

  4. yakra commented on Jan 3, 2021

    @yakra
    Contributor

    I had a similar error in the past but got more detailed info above (I think it was something like "no connected route found for xxx" and could check the line before and found the error).

    Sounds like a bit of a different underlying error in that case, that played out differently.

    When I run the C++ siteupdate with TravelMapping/HighwayData@90b185f, I do see

    ERROR: frabfcd71.csv: root frabfc.d018271cyr not matched by any connected route root.
    ERROR: frabfcd71.csv: root frabfc.d018271 not matched by any connected route root.
    

    and then eventually

    [45.1] ABORTING due to 4 errors:
    1: Could not parse frabfcd71_con.csv line: [frabfcd71;D182;-71;Cyr;Saint-Cyr;frabfc.d018271cyr], expected 5 fields, found 6
    2: Could not parse frabfcd71_con.csv line: [frabfcd71;D182;-71;;Dulphey;frabfc.d018271], expected 5 fields, found 6
    3: frabfcd71.csv: root frabfc.d018271cyr not matched by any connected route root.
    4: frabfcd71.csv: root frabfc.d018271 not matched by any connected route root.
    
  5. yakra commented on Jan 3, 2021

    @yakra
    Contributor

    I think I've fixed it. Testing.

  6. added a commit that references this issue on Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions