Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: time data '2014-09-19 15:51:55 +0100' does not match format '%Y-%m-%d %H:%M:%S +0000' while building Glyphs_Sapperlot.glyphs #14

Closed
marekjez86 opened this issue Feb 13, 2016 · 3 comments

Comments

@marekjez86
Copy link
Contributor

I built the pipeline in the morning (PDT) on 2016-02-12.
I found Glyphs_Sapperlot.glyphs in https://github.com/DrTypo/sapperlot and decided to try using it as an input to the pipeline (my mac glyphs.app can export unhinted OTF files from Glyphs_Sapperlot.glyphs).

We get the following error while running the pipeline:

==== building src/Glyphs_Sapperlot.glyphs ====

Checking Glyphs source for illegal glyph names
Interpolating master UFOs from Glyphs source

Parsing .glyphs file
Casting parsed values
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/fontmake/main.py", line 51, in
main()
File "/usr/local/lib/python2.7/dist-packages/fontmake/main.py", line 39, in main
project.run_from_glyphs(glyphs_path, **args)
File "/usr/local/lib/python2.7/dist-packages/fontmake/font_project.py", line 136, in run_from_glyphs
ufos = self.build_instances(glyphs_path, is_italic)
File "/usr/local/lib/python2.7/dist-packages/fontmake/font_project.py", line 75, in build_instances
return build_instances(glyphs_path, master_dir, instance_dir, is_italic)
File "/usr/local/lib/python2.7/dist-packages/glyphs2ufo/glyphslib.py", line 100, in build_instances
filename, italic, include_instances=True)
File "/usr/local/lib/python2.7/dist-packages/glyphs2ufo/glyphslib.py", line 57, in load_to_ufos
data = load(ifile)
File "/usr/local/lib/python2.7/dist-packages/glyphs2ufo/glyphslib.py", line 38, in load
return loads(fp.read(), dict_type=dict_type)
File "/usr/local/lib/python2.7/dist-packages/glyphs2ufo/glyphslib.py", line 49, in loads
cast_data(data)
File "/usr/local/lib/python2.7/dist-packages/glyphs2ufo/casting.py", line 49, in cast_data
cast_data(cur_data, dict(cur_type))
File "/usr/local/lib/python2.7/dist-packages/glyphs2ufo/casting.py", line 51, in cast_data
data[key] = cur_type(data[key])
File "/usr/local/lib/python2.7/dist-packages/glyphs2ufo/casting.py", line 249, in glyphs_datetime
return datetime.strptime(string, '%Y-%m-%d %H:%M:%S +0000')
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '2014-09-19 15:51:55 +0100' does not match format '%Y-%m-%d %H:%M:%S +0000'

@adrientetar
Copy link
Contributor

In datetime.strptime(string, '%Y-%m-%d %H:%M:%S +0000') replace +0000 with %z.

@jamesgk
Copy link
Contributor

jamesgk commented Feb 16, 2016

%z is not supported on all platforms in Python 2 (see http://bugs.python.org/issue6641), I think I'd rather just chop off the timezone for now.

@adrientetar
Copy link
Contributor

I couldn't find which platforms are affected. Then:

string, tz = string[:-6], string[-4:]
dt = datetime.datetime.strptime(string, '%Y-%m-%d %H:%M:%S')
return dt + datetime.timedelta(hours=int(tz[:2]), minutes=int(tz[2:]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants