Robot Framework with Scapy - Error

60 views
Skip to first unread message

Sreeram Rengasamy

unread,
Sep 26, 2024, 12:46:19 PM9/26/24
to robotframework-users
Hi All,

I am getting the basic error will running the Scapy Library, can anyone suggest the way to resolve this?

n$ python -m ScapyLibrary.layerDoc Scapy.html
Command 'python' not found, did you mean:
  command 'python3' from deb python3
  command 'python' from deb python-is-python3
midmarket@midmarket-virtual-machine:~/TREX_Automation$ python3 -m ScapyLibrary.layerDoc Scapy.html
WARNING: [bgp.py] use_2_bytes_asn: True
WARNING: CARP overwrites VRRP !
ERROR: Loading module scapy.layers.cansocket_python_can
Traceback (most recent call last):
  File "/home/midmarket/.local/lib/python3.10/site-packages/scapy/main.py", line 204, in load_contrib
    importlib.import_module("scapy.contrib." + name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/midmarket/.local/lib/python3.10/site-packages/scapy/contrib/cansocket_python_can.py", line 29, in <module>
    from can import Message as can_Message
ModuleNotFoundError: No module named 'can'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/midmarket/.local/lib/python3.10/site-packages/scapy/main.py", line 156, in _load
    mod = importlib.import_module(module)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'scapy.layers.cansocket_python_can'
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.10/runpy.py", line 157, in _get_module_details
    code = loader.get_code(mod_name)
  File "<frozen importlib._bootstrap_external>", line 1017, in get_code
  File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/midmarket/.local/lib/python3.10/site-packages/ScapyLibrary/layerDoc.py", line 106
    print "Generate layer doc to %s" % os.path.abspath(docFile)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
mx$ python3
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()

Hélio Guilherme

unread,
Sep 26, 2024, 1:13:50 PM9/26/24
to robotframework-users
This error is typical when running a Python 2.7 script in Python 3:


 File "/home/midmarket/.local/lib/python3.10/site-packages/ScapyLibrary/layerDoc.py", line 106
    print "Generate layer doc to %s" % os.path.abspath(docFile)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

You should contact maintainers of the project and ask if they have a Python 3 version. Or try to fix yourself, at least the print calls without parentheses.


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/CADgTJcGNV-UJOz5NGP4_gqLbyn69k9JoTO%3DyZpFiUMt6CzMHfw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages