oberstet/taschenmesser

AttributeError: 'module' object has no attribute 'match_hostname'

Vayel opened this issue · 7 comments

On Fedora 20, with Python 2.7, I runned the test command of that Makefile and got the following error:

$ make img
scons img
scons: Reading SConscript files ...
AttributeError: 'module' object has no attribute 'match_hostname':
  File "/home/vincent/Documents/Prog/crossbar/crossbarwww/SConstruct", line 86:
    taschenmesser = pkg_resources.resource_filename('taschenmesser', '..')
  File "/home/vincent/.local/share/virtualenvs/crossbarwww/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1128:
    return get_provider(package_or_requirement).get_resource_filename(
  File "/home/vincent/.local/share/virtualenvs/crossbarwww/lib/python2.7/site-packages/pkg_resources/__init__.py", line 398:
    __import__(moduleOrReq)
  File "/home/vincent/.local/share/virtualenvs/crossbarwww/lib/python2.7/site-packages/taschenmesser/__init__.py", line 20:
    import aws
  File "/home/vincent/.local/share/virtualenvs/crossbarwww/lib/python2.7/site-packages/taschenmesser/aws.py", line 32:
    _old_match_hostname = ssl.match_hostname
make: *** [img] Error 2

Before that, I did:

git clone https://github.com/crossbario/crossbarwww
git clone https://github.com/crossbario/crossbar.wiki.git

cd crossbarwww
pew new crossbarwww # Create a virtualenv with Python 2.7

(crossbarwww) [vincent@vincent crossbarwww]$ make requirements
(crossbarwww) [vincent@vincent crossbarwww]$ pip install --egg scons

Thanks.

What Python version? The match_hostname monkey patching was added because of strict hostname stuff in Python 2.7.9 ...

Python 2.7.5

I've pushed Taschenmesser 0.1.7 to PyPI .. this should fix the error you see. Could you retry?

The error disapeared but I got this one:

(crossbarwww) [vincent@vincent crossbarwww]$ make img 
scons img
scons: Reading SConscript files ...
Taschenmesser: Google Closure Compiler won't be available (no JAVA_HOME set)
Taschenmesser: Inkscape executable not found - SVG to PNG conversion won't be available.
scons: done reading SConscript files.
scons: Building targets ...
Scour(["website/crossbario/static/img/gen/crossbar_icon.svg"], ["design/crossbar_icon.svg"])

Using Scour options:

{'digits': 5,
 'embed_rasters': True,
 'enable_viewboxing': True,
 'group_collapse': True,
 'group_create': False,
 'indent_type': None,
 'infilename': None,
 'keep_defs': False,
 'keep_editor_data': False,
 'outfilename': None,
 'protect_ids_list': None,
 'protect_ids_noninkscape': False,
 'protect_ids_prefix': None,
 'quiet': False,
 'remove_metadata': True,
 'renderer_workaround': True,
 'shorten_ids': True,
 'shorten_ids_prefix': '',
 'simple_colors': True,
 'strip_comments': True,
 'strip_ids': True,
 'strip_xml_prolog': False,
 'style_to_xml': True}
None

scour 0.30
Copyright Jeff Schiller, Louis Simard, 2010
 File: design/crossbar_icon.svg 
 Time taken: 0.2s
 Number of elements removed: 74
 Number of attributes removed: 112
 Number of unreferenced id attributes removed: 6
 Number of style properties fixed: 48
 Number of raster images embedded inline: 0
 Number of path segments reduced/removed: 12
 Number of bytes saved in path data: 100
 Number of bytes saved in colors: 24
 Number of points removed from polygons: 0
 Number of bytes saved in comments: 50
 Number of bytes saved in id attributes: 0
 Number of bytes saved in lengths: 0
 Number of bytes saved in transformations: 6
 Original file size: 31327 bytes; new file size: 957 bytes (3.054%)
Svg2Png(["website/crossbario/static/img/gen/crossbar_icon.png"], ["website/crossbario/static/img/gen/crossbar_icon.svg"])
scons: *** [website/crossbario/static/img/gen/crossbar_icon.png] TypeError : sequence item 0: expected string, NoneType found
Traceback (most recent call last):
  File "/home/vincent/.local/share/virtualenvs/crossbarwww/lib/scons-2.3.0/SCons/Action.py", line 1062, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "/home/vincent/.local/share/virtualenvs/crossbarwww/lib/python2.7/site-packages/taschenmesser/svg.py", line 98, in Svg2Png
    print ' '.join(cmd)
TypeError: sequence item 0: expected string, NoneType found
scons: building terminated because of errors.
make: *** [img] Error 2
(crossbarwww) [vincent@vincent crossbarwww]$

Probably more related to crossbarwww than to this repo.

Taschenmesser: Inkscape executable not found - SVG to PNG conversion won't be available.

We should handle that better of course .. but you need to have Inkscape installed.

It works. Thanks.