1

I'm using Pyshark and Python 2.6 on OS X 10.10. I simply try to import pyshark in my code, and this error is thrown. Any idea of what could be going wrong?

/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 "/Users/spencergardner/Google Drive/development/python-sockets/sniff.py"
Traceback (most recent call last):
  File "/Users/spencergardner/Google Drive/development/python-sockets/sniff.py", line 1, in <module>
    import pyshark
  File "/Library/Python/2.6/site-packages/pyshark/__init__.py", line 1, in <module>
    from pyshark.capture.live_capture import LiveCapture
  File "/Library/Python/2.6/site-packages/pyshark/capture/live_capture.py", line 1, in <module>
    from pyshark.capture.capture import Capture
  File "/Library/Python/2.6/site-packages/pyshark/capture/capture.py", line 12, in <module>
    from pyshark.tshark.tshark_xml import packet_from_xml_packet, psml_structure_from_xml
  File "/Library/Python/2.6/site-packages/pyshark/tshark/tshark_xml.py", line 5, in <module>
    from pyshark.packet.layer import Layer
  File "/Library/Python/2.6/site-packages/pyshark/packet/layer.py", line 57
    return {slot: getattr(self, slot) for slot in self.__slots__}
                                        ^
SyntaxError: invalid syntax
Dhia
  • 10,119
  • 11
  • 58
  • 69
freedomflyer
  • 2,431
  • 3
  • 26
  • 38

1 Answers1

2

The error is due to using a dictionary comprehension, a language feature that was introduced to Python 2 in 2.7, not the 2.6 you're trying to use. Apple ships OS X 10.10 with both 2.7 and 2.6. Is there a reason you can't use 2.7 instead?

Ned Deily
  • 83,389
  • 16
  • 128
  • 151