Code Monkey home page Code Monkey logo

Comments (4)

claws avatar claws commented on June 18, 2024

Can you give me a stack trace of the crash output and perhaps an example of the date format that is causing the problem?

from gramps2gource.

grocanar avatar grocanar commented on June 18, 2024

Hi

here is the output of the error
python gramps2gource.py --name="Eric Doutreleau" --db=data.gramps
INFO - Loading Gramps database from data.gramps
INFO - Generating pedigree output for: Eric Doutreleau
ERROR - Problem date '0006-02-30':
Traceback (most recent call last):
File "gramps2gource.py", line 349, in
g2g.pedigree(args.names, args.output)
File "gramps2gource.py", line 136, in pedigree
associated_events = person.associated_events()
File "/home/grocanar/gramps2gource/gramps.py", line 323, in
associated_events
if event.datetime:
File "/home/grocanar/gramps2gource/gramps.py", line 136, in datetime
raise Exception(ex)
Exception: day is out of range for month

and here is the "faulty" lines

Death

as you can see the data is in the French republican format.
the nicest thing would be to convert the date but one can just ignore
the date in order not to have the exception raised.

Le 21/04/2016 02:05, claws a Γ©crit :

Can you give me a stack trace of the crash output and perhaps an
example of the date format that is causing the problem?

β€”
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1 (comment)

from gramps2gource.

claws avatar claws commented on June 18, 2024

Unfortunately I could not just ignore the date or catch the date conversion exception and return an empty date. Undated events are explicitly filtered out in the pedigree function. It does not make sense to allow undated events to propagate through to the output because I don't have any reliable method to place the events into order.

I have created an update in a branch called allow_custom_date_handlers. The change candidate provides the user with the ability to register their own date parser that will be called whenever a matching cformat is encountered. If no cformat is specified with the gramps date item or there is no date parser registered for the cformat then a default date parser will be called. You should be able to create and register you own date parser for the French Republican cformat type.

To test if this change works for your use case could you test the candidate change? To do this you will first need to pull the allow_custom_date_handlers branch. You can do this using:

$ cd <directory to store temporary clone>
$ git clone -b allow_custom_date_handlers https://github.com/claws/gramps2gource.git temp_g2g
$ cd temp_g2g

Instead of running gramps2gource.py use custom_date_g2g.py. You can use the same command line arguments. E.g. python custom_date_g2g.py --name="Eric Doutreleau" --db=data.gramps.

However, prior to running the script you will need to implement the my_date_handler function to perform the action necessary to convert a French Republican date string into a valid datetime. You then need to modify the line where the date parser function is registered with the gramps module. So you will probably change the line from:
gramps.date_processor.register('my_cal_format', my_date_handler)
to
gramps.date_processor.register('French Republican', my_date_handler).

Let me know how you go.

from gramps2gource.

claws avatar claws commented on June 18, 2024

Proposed modification was merged in #2.

from gramps2gource.

Related Issues (1)

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.