Just did a fresh clone on MacOS X 10.8.2 (Mountain Lion) and hitting problems in example 6-1, linkedin__analyze_companies.py: Exception: Invalid field name: Company!
See my fix below...
I am running python2.7 within virtualenv and have prettytable==0.6.1.
here's the stack trace:
Traceback (most recent call last):
File "/Applications/eclipse/plugins/org.python.pydev_2.7.1.2012100913/pysrc/pydevd.py", line 1397, in
debugger.run(setup['file'], None, None)
File "/Applications/eclipse/plugins/org.python.pydev_2.7.1.2012100913/pysrc/pydevd.py", line 1090, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/Users/jeff/Documents/workspace/Mining-the-Social-Web/python_code/linkedin__analyze_companies.py", line 23, in
pt = PrettyTable(fields=['Company', 'Freq'])
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 125, in init
self._validate_option(option, kwargs[option])
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 210, in _validate_option
self._validate_all_field_names(option, val)
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 285, in _validate_all_field_names
self._validate_field_name(name, x)
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 280, in _validate_field_name
raise Exception("Invalid field name: %s!" % val)
Exception: Invalid field name: Company!
I found the following 3 changes on lines 23-28 were necessary to make this module work:
Just did a fresh clone on MacOS X 10.8.2 (Mountain Lion) and hitting problems in example 6-1, linkedin__analyze_companies.py: Exception: Invalid field name: Company!
See my fix below... I am running python2.7 within virtualenv and have prettytable==0.6.1. here's the stack trace:
Traceback (most recent call last): File "/Applications/eclipse/plugins/org.python.pydev_2.7.1.2012100913/pysrc/pydevd.py", line 1397, in
debugger.run(setup['file'], None, None)
File "/Applications/eclipse/plugins/org.python.pydev_2.7.1.2012100913/pysrc/pydevd.py", line 1090, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/Users/jeff/Documents/workspace/Mining-the-Social-Web/python_code/linkedin__analyze_companies.py", line 23, in
pt = PrettyTable(fields=['Company', 'Freq'])
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 125, in init
self._validate_option(option, kwargs[option])
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 210, in _validate_option
self._validate_all_field_names(option, val)
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 285, in _validate_all_field_names
self._validate_field_name(name, x)
File "/Users/jeff/.virtualenvs/kitsink/lib/python2.7/site-packages/prettytable.py", line 280, in _validate_field_name
raise Exception("Invalid field name: %s!" % val)
Exception: Invalid field name: Company!
I found the following 3 changes on lines 23-28 were necessary to make this module work:
23: pt = PrettyTable(['Company', 'Freq'])
25: pt.align['Company'] = 'l'
28: print(pt)