Giter Site home page Giter Site logo

Comments (7)

altendky avatar altendky commented on July 17, 2024

Seems ok in Linux in 3.5-3.9, fwiw.

Linux 3.5-3.9
$ python3.5 -c 'import time; f = "%a %b %d %H:%M:%S %Y"; d = "Fri Feb 12 16:02:56 2021"; r = time.strptime(d, f); print(r)'
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
$ python3.6 -c 'import time; f = "%a %b %d %H:%M:%S %Y"; d = "Fri Feb 12 16:02:56 2021"; r = time.strptime(d, f); print(r)'
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
$ python3.7 -c 'import time; f = "%a %b %d %H:%M:%S %Y"; d = "Fri Feb 12 16:02:56 2021"; r = time.strptime(d, f); print(r)'
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
$ python3.8 -c 'import time; f = "%a %b %d %H:%M:%S %Y"; d = "Fri Feb 12 16:02:56 2021"; r = time.strptime(d, f); print(r)'
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
$ python3.9 -c 'import time; f = "%a %b %d %H:%M:%S %Y"; d = "Fri Feb 12 16:02:56 2021"; r = time.strptime(d, f); print(r)'
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)

from plotman.

altendky avatar altendky commented on July 17, 2024

Likewise in Windows 3.5-3.9. No other inspiration at the moment. Also confirmed with romp across macOS as well.

Windows 3.5-3.9
PS C:\Users\sda> py -3.5 -c "import time; f = '%a %b %d %H:%M:%S %Y'; d = 'Fri Feb 12 16:02:56 2021'; r = time.strptime(d, f); print(r)"
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
PS C:\Users\sda> py -3.6 -c "import time; f = '%a %b %d %H:%M:%S %Y'; d = 'Fri Feb 12 16:02:56 2021'; r = time.strptime(d, f); print(r)"
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
PS C:\Users\sda> py -3.7 -c "import time; f = '%a %b %d %H:%M:%S %Y'; d = 'Fri Feb 12 16:02:56 2021'; r = time.strptime(d, f); print(r)"
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
PS C:\Users\sda> py -3.8 -c "import time; f = '%a %b %d %H:%M:%S %Y'; d = 'Fri Feb 12 16:02:56 2021'; r = time.strptime(d, f); print(r)"
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)
PS C:\Users\sda> py -3.9 -c "import time; f = '%a %b %d %H:%M:%S %Y'; d = 'Fri Feb 12 16:02:56 2021'; r = time.strptime(d, f); print(r)"
time.struct_time(tm_year=2021, tm_mon=2, tm_mday=12, tm_hour=16, tm_min=2, tm_sec=56, tm_wday=4, tm_yday=43, tm_isdst=-1)

from plotman.

ericaltendorf avatar ericaltendorf commented on July 17, 2024

stacktrace from reporter:

    jobs = Job.get_running_jobs(dir_cfg['log'])
  File "/chia/plotman/job.py", line 66, in get_running_jobs
    jobs.append(Job(proc, logroot))
  File "/chia/plotman/job.py", line 135, in init
    self.init_from_logfile()
  File "/chia/plotman/job.py", line 156, in init_from_logfile
    self.start_time = datetime.strptime(m.group(1), '%a %b  %d %H:%M:%S %Y')
  File "/usr/lib/python3.8/strptime.py", line 568, in strptime_datetime
    tt, fraction, gmtoff_fraction = strptime(datastring, format)
  File "/usr/lib/python3.8/strptime.py", line 349, in strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data 'Fri Feb 12 16:02:56 2021' does not match format '%a %b  %d %H:%M:%S %Y'

platform 5.8.0-43-generic #49-Ubuntu SMP Fri Feb 5 03:01:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

One thing that looks suspicious is the two spaces between %b and %d in the format string?

from plotman.

johnj212 avatar johnj212 commented on July 17, 2024

Hi, I've tested and to reproduce the issue set the locale time is set to : LC_TIME=de_CH.UTF-8 it crashes, but when I set this to LC_TIME=en_US.UTF-8 no problem.

from plotman.

ericaltendorf avatar ericaltendorf commented on July 17, 2024

Thanks! I suspected it might have to do with locale. I'm guessing in de_CH the expectation for Friday abbreviation is 'Fr' for Freitag?

FWIW, we're reading from a file produced by a different program in a different code base (the chia plotter) so we have no real guarantee of the format or locale with which it was produced.

The right approach here is probably to do something fuzzier and best-effort to make as much sense of the log datetime as we can.

from plotman.

loysollivier avatar loysollivier commented on July 17, 2024

A workaround is to use:
export LC_TIME=en_US.UTF-8

from plotman.

BasilHorowt avatar BasilHorowt commented on July 17, 2024

The linked fix seems to be on development only, this issue can be closed once in main?

from plotman.

Related Issues (20)

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.