Issue #98 resolved

Fatal exception when trying to add a part from library

Anton Veretenenko
created an issue

Got it on version 0.8.0-r1600

mainapp.py(35):unhandledExceptionDialog - Traceback (most recent call last):
  File "rzn/ui/dialog/librarydialog.py", line 195, in treeSelectionChanged
  File "rzn/vc/vclib.py", line 68, in get_lib_info
  File "rzn/vc/vclib.py", line 55, in _parse_date
  File "_strptime.py", line 325, in _strptime
ValueError: time data 'Sun Nov 03 16:20:00 2013' does not match format '%a %b %d %H:%M:%S %Y'

Comments (14)

  1. Anton Veretenenko reporter
    • edited description

    got the same error on different line when selecting in the expanded tree

    Traceback (most recent call last):
      File "rzn/ui/dialog/librarydialog.py", line 190, in treeSelectionChanged
      File "rzn/vc/vclib.py", line 86, in get_part_info
      File "rzn/vc/vclib.py", line 55, in _parse_date
      File "_strptime.py", line 325, in _strptime
    ValueError: time data 'Sun Nov 03 14:01:47 2013' does not match format '%a %b %d %H:%M:%S %Y'
    
  2. Anton Veretenenko reporter

    I guess you're right, I'm using local regional formats.

    LANG=en_US.UTF-8
    LANGUAGE=en_US:en
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC=ru_RU.UTF-8
    LC_TIME=ru_RU.UTF-8
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY=ru_RU.UTF-8
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER=ru_RU.UTF-8
    LC_NAME=ru_RU.UTF-8
    LC_ADDRESS=ru_RU.UTF-8
    LC_TELEPHONE=ru_RU.UTF-8
    LC_MEASUREMENT=ru_RU.UTF-8
    LC_IDENTIFICATION=ru_RU.UTF-8
    LC_ALL=
    
  3. Razen repo owner

    Strange, it works for me if I set my locale to match yours.

    Could you try the following from the razen prompt:

    import datetime
    

    followed by

    datetime.datetime.now().strftime('%a %b %d %H:%M:%S %Y')
    

    ?

  4. Razen repo owner

    Razen should be setting LC_TIME to the C locale at startup anyway, which should have the same effect. So somewhere the RU time locale is getting re-set. Can you see what razen thinks the locale is?

    import locale
    
    locale.getdefaultlocale()
    
    locale.getlocale(locale.LC_TIME)
    

    Thanks!

  5. Razen repo owner

    Ok, that explains the bug, now I just need to figure out how that's getting reset.

    Can you try setting the locale manually after startup and seeing if that works:

    import locale
    
    locale.setlocale(locale.LC_TIME, "C")
    

    This should be equivalent to what you did from the terminal

  6. Log in to comment