GithubHelp home page GithubHelp logo

Comments (7)

syunusic avatar syunusic commented on July 24, 2024 1

Wow... that was it. Thanks!

from igc2csv.

ScottStanton avatar ScottStanton commented on July 24, 2024

Change line 110 to:
flight['flightdate'] = datetime.date(int(line[9:11])+2000, int(line[7:9]), int(line[5:7]))

from igc2csv.

ScottStanton avatar ScottStanton commented on July 24, 2024

I fixed it in my fork of the code. Feel free to commit my changes.
https://github.com/ScottStanton/IGC2CSV

from igc2csv.

syunusic avatar syunusic commented on July 24, 2024

Hi! I had the same problem... this is what happened the first time I run it:

$ python2 IGC2CSV.py /tmp/230325175253.igc 
Number of arguments: 2
Argument List: ['IGC2CSV.py', '/tmp/230325175253.igc']
Single IGC file supplied: /tmp/230325175253.igc
1 flights ready to process...
Traceback (most recent call last):
  File "IGC2CSV.py", line 254, in <module>
    flight = parse_igc(flight)
  File "IGC2CSV.py", line 16, in parse_igc
    recordtypes[linetype](line, flight)
  File "IGC2CSV.py", line 101, in logline_H
    headertypes[line[1:5]](line[5:], flight)
  File "IGC2CSV.py", line 110, in logline_H_FDTE
    flight['flightdate'] = datetime.date(int(line[4:6])+2000, int(line[2:4]), int(line[0:2]))
ValueError: invalid literal for int() with base 10: ':2'

Then I change line 110 as @ScottStanton suggested and this is the error I got now:

$ python2 IGC2CSV.py /tmp/230325175253.igc 
  File "IGC2CSV.py", line 111
    flight['flightdate'] = datetime.date(int(line[9:11])+2000, int(line[7:9]), int(line[5:7]))
         ^
IndentationError: expected an indented block

Please help!

from igc2csv.

ScottStanton avatar ScottStanton commented on July 24, 2024

Can you post lines 107 to 114 from your code?

from igc2csv.

syunusic avatar syunusic commented on July 24, 2024

Sure:

# Date format: DDMMYY
# (did we learn nothing from Y2K?)
def logline_H_FDTE(line, flight):
#  flight['flightdate'] = datetime.date(int(line[4:6])+2000, int(line[2:4]), int(line[0:2]))
flight['flightdate'] = datetime.date(int(line[9:11])+2000, int(line[7:9]), int(line[5:7]))
  print "Flight date: {}".format(flight['flightdate'])



from igc2csv.

ScottStanton avatar ScottStanton commented on July 24, 2024

Indent the line that start with 'flight' to match the indentation of the 'print' below it.
Python is very particular about indentation.

from igc2csv.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.