IPOptions in scapy3.0.0 and python3.5 is throwing the error - scapy

My packet:
a=IP(src="30.1.1.2",dst="20.1.1.2",options=IPOption('\x83\x07\x04\x00\x00\x00\x00\x00'),)
I am getting the error:
a=bytes(IP(src="30.1.1.2",dst="20.1.1.2",options=IPOption('\‌​x83\x07\x04\x00\x00\‌​x00\x00\x00'),))
Traceback (most recent call last):
File "/usr/lib/python3.4/code.py", line 90, in runcode exec(code, self.locals)
File "<console>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/scapy/base_classes.p‌​y", line 197, in call
cls = cls.dispatch_hook(*args, **kargs)
File "/usr/local/lib/python3.4/dist-packages/scapy/layers/inet.py‌​", line 161, in dispatch_hook
opt = pkt[0] & 0x1f
TypeError: unsupported operand type(s) for &: 'str' and 'int' –

Since you're using Python 3, you should use bytes instead of str for the IP options:
a = bytes(IP(src="30.1.1.2", dst="20.1.1.2",
options=IPOption(b'\x83\x07\x04\x00\x00\x00\x00\x00'))

Related

When i run webdriver, the following error happens

Traceback (most recent call last):
File "C:\Users\Njoroge\OneDrive\Desktop\FollowerBot-main\FollowerBot-main\get_instagram_followers.py", line 46, in <module>
ig.setup()
File "C:\Users\Njoroge\OneDrive\Desktop\FollowerBot-main\FollowerBot-main\get_instagram_followers.py", line 13, in setup
Setup.init(self)
File "C:\Users\Njoroge\OneDrive\Desktop\FollowerBot-main\FollowerBot-main\init.py", line 15, in init
self.browser = uc.Chrome(options=chrome_options, version_main=108)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 53, in __new__
instance.__init__(*args, **kwargs)
TypeError: WebDriver.__init__() got an unexpected keyword argument 'version_main'
help please, i think its about my chrome version but its up to date.

Attribute error: comtypes has no module named ISpeech

Traceback (most recent call last):
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "h:\My Drive\Semester 6\Artificial Intelligence\JARVIS\jarvis.py", line 7, in <module>
engine = pt.init()
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\driver.py", line 52, in __init__
self._driver = self._module.buildDriver(weakref.proxy(self))
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\drivers\sapi5.py", line 30, in buildDriver
return SAPI5Driver(proxy)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyttsx3\drivers\sapi5.py", line 35, in __init__
self._tts = comtypes.client.CreateObject('SAPI.SPVoice')
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\ammar\AppData\Local\Programs\Python\Python310\lib\site-packages\comtypes\client\__init__.py", line 112, in GetBestInterface
interface = getattr(mod, itf_name)
AttributeError: module 'comtypes.gen.SpeechLib' has no attribute 'ISpeechVoice'
I have also tried re-installing Python and upgrading comtypes but everytime I get the same error. The program was working fine before I installed opencv-python. I have tried uninstalling it too but it doesn't make any difference.

Yahoo_Finance Package for Python - Share() does not work anymore

Since today I am experiencing some errors caused by the yahoo_finance package version 1.4.
Here is a code example that is causing the error:
from yahoo_finance import Share
Apple = Share("AAPL")
Results in the following Error:
Traceback (most recent call last):
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 120, in _request
_, results = response['query']['results'].popitem()
AttributeError: 'NoneType' object has no attribute 'popitem'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 123, in _request
raise YQLQueryError(response['error']['description'])
KeyError: 'error'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Julian\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-3-44fc1f59aa21>", line 1, in <module>
Apple = Share("AAPL")
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 178, in __init__
self.refresh()
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 142, in refresh
self.data_set = self._fetch()
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 181, in _fetch
data = super(Share, self)._fetch()
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 134, in _fetch
data = self._request(query)
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 125, in _request
raise YQLResponseMalformedError()
yahoo_finance.YQLResponseMalformedError: Response malformed.
Do you experience similar issues or is this only an issue for me personally?
Thank you for your replies.
If yes - what are potential fixes for this issue?

Scikit-Image gives me this error

File "/usr/local/lib/python3.5/dist-packages/skimage/io/_plugins/pil_plugin.py", line 53, in pil_to_ndarray
im.getdata()[0]
File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 1165, in getdata
self.load()
File "/usr/local/lib/python3.5/dist-packages/PIL/ImageFile.py", line 212, in load
s = read(self.decodermaxblock)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Custom vgg2.py", line 154, in <module>
img = io.imread(file_path)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/_io.py", line 61, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/manage_plugins.py", line 211, in call_plugin
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/_plugins/pil_plugin.py", line 37, in imread
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
File "/usr/local/lib/python3.5/dist-packages/skimage/io/_plugins/pil_plugin.py", line 61, in pil_to_ndarray
raise ValueError(error_message)
ValueError: Could not load ""
Reason: "[Errno 5] Input/output error"
Please see documentation at: http://pillow.readthedocs.org/en/latest/installation.html#external-libraries

flask-sqlacodegen suports python 3.4?

I am trying to generate a flask-sqlalchemy for an existing mysql db.
I used the following command
flask-sqlacodegen --outfile rcdb.py mysql://username:password#hostname/tablename
The project uses python 3.4. Any clues?
```Traceback (most recent call last):
File "/var/www/devaccess/py_api/ds/venv/bin/flask-sqlacodegen", line 11, in
sys.exit(main())
File "/var/www/devaccess/py_api/ds/venv/lib/python3.4/site-packages/sqlacodegen/main.py", line 59, in main
Traceback (most recent call last):
File "/var/www/devaccess/py_api/ds/venv/bin/flask-sqlacodegen", line 11, in
sys.exit(main())
File "/var/www/devaccess/py_api/ds/venv/lib/python3.4/site-packages/sqlacodegen/main.py", line 59, in main
args.flask, ignore_cols, args.noclasses)
File "/var/www/devaccess/py_api/ds/venv/lib/python3.4/site-packages/sqlacodegen/codegen.py", line 606, in init
model = ModelClass(table, links[table.name], inflect_engine, not nojoined)
File "/var/www/devaccess/py_api/ds/venv/lib/python3.4/site-packages/sqlacodegen/codegen.py", line 335, in init
relationship_ = ManyToManyRelationship(self.name, target_cls, association_table, inflect_engine)
File "/var/www/devaccess/py_api/ds/venv/lib/python3.4/site-packages/sqlacodegen/codegen.py", line 501, in init
self.kwargs['secondary'] = repr(assocation_table.schema + '.' + assocation_table.name)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
```
try specifying your database schema with option --schema

Resources