Hmmm I had an interesting issue and I don't understand why, but would love to.
→ python -V
Python 2.7.1
Let's check how my my program is starting
→ head -2 myprog.py
#!/usr/bin/env python2.7
# encoding: utf-8
Let's check what it returns
→ /usr/bin/env python2.7
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
OK so far so good. Let's try to execute the code.
→ python myprog.py -h
Traceback (most recent call last):
File "/Users/foobar/myprog.py", line 16, in <module>
from lxml.html import html5parser
File "/Library/Python/2.7/site-packages/lxml/html/__init__.py", line 42, in <module>
from lxml import etree
ImportError: dlopen(/Library/Python/2.7/site-packages/lxml/etree.so, 2): Symbol not found: _htmlParseChunk
Referenced from: /Library/Python/2.7/site-packages/lxml/etree.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/lxml/etree.so
hmmm ok. lxml… there are plenty of other stackoverflow talking about this specific issue. BUT Weird because I have another script working perfectly with the same module. So I decided to look at the way I was using the other scripts, and I have seen that I was starting it directly.
→ ~/myprog.py -h
usage: myprog.py [-h] -u USERNAME [-o ARCHIVEPATH] [-f FILE_FORMAT]
Export html content from Zorglub
So when I'm using python for starting it, it doesn't work. When I use the program directly it is working. WHY? A python expert in the room?