NameError: name 'error' is not defined - python-3.6

So I was making a cheat program for a game using scapy, and when I ran it in visual studios it worked fine, but when I say in cmd
python myprogram.py
It says:
Traceback (most recent call last):
File "ScapyTest.py", line 135, in <module>
sniff(prn=action)
File "C:\Program Files\Python36\lib\site-packages\scapy\sendrecv.py", line
592, in sniff
sel = select([s],[],[],remain)
File "C:\Program Files\Python36\lib\site-packages\scapy\supersocket.py",
line 38, in fileno
return self.ins.fileno()
File "C:\Program Files\Python36\lib\site-packages\scapy\arch\pcapdnet.py",
line 232, in fileno
error("Cannot get selectable PCAP fd on Windows")
NameError: name 'error' is not defined
Im unsure if it literally means it doesnt know what an error is, or if there is some logical reason behind it not knowing what an error is. It is something with sniff but im not sure what. There are also no errors in my code so I dont know why its saying this

This looks like an old bug. You should get the current development version (from the official repository, install it and try again.

Related

An error occurred for Current measurement with ESP32s and PZEM004T v2

I'm using ESP32s and PZEM004T V2.0 for the current measurement project.
While executing I get the following error:
esptool.py v3.0-dev
Serial port COM5
Connecting...
Traceback (most recent call last):
File "esptool.py", line 3682, in <module>
File "esptool.py", line 3675, in _main
File "esptool.py", line 3330, in main
File "esptool.py", line 512, in connect
File "esptool.py", line 492, in _connect_attempt
File "esptool.py", line 431, in sync
File "esptool.py", line 369, in command
File "esptool.py", line 332, in write
File "site-packages\serial\serialwin32.py", line 323, in write
serial.serialutil.SerialTimeoutException: Write timeout
Failed to execute script esptool
An error occurred while uploading the sketch
Any idea what should I do?
Looks like you're running on a windows box. Make sure that your esp32 is connected to a working USB socket on your machine (I have a couple that work for everything except arduino). Make sure you have the correct COM port selected - one esp32 might be COM5 and another might be COM6, and yes, the bindings may persist. I'm currently up to COM54 or something on my machine. Make sure you haven't screwed up your wiring somewhere. If you've shorted your circuit somewhere, nothing is going to make that processor available. And.... it's always possible that you've fried the thing by hitting it with too much voltage/current for it to handle. Your title does mention current measurement - are you sure the esp32 is still functional? (Is your old code running on it and doing something to indicate so?)

iprof and iprof_totals profiling error

I get this error after trying :
openmdao iprof x.py
or
openmdao iprof_totals x.py
on my terminal. Any idea why it could be? Do we have a simple sample code where the iprof works smoothly.
Traceback (most recent call last):
File "/home/user/miniconda3/bin/openmdao", line 11, in
sys.exit(openmdao_cmd())
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/utils/om.py", line 403, in openmdao_cmd
options.executor(options)
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprofile.py", line 373, in _iprof_totals_exec
_iprof_py_file(options)
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprofile.py", line 429, in _iprof_py_file
_finalize_profile()
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprofile.py", line 183, in _finalize_profile
qfile, qclass, qname = find_qualified_name(filename, int(line), cache, full=False)
File "/home/user/miniconda3/lib/python3.6/site-packages/openmdao/devtools/iprof_utils.py", line 73, in find_qualified_name
with open(filename, 'Ur') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'packages/openmdao/jacobians/jacobian.py'
I looked into this and there is currently a bug when using 'openmdao iprof' and 'openmdao iprof_totals' on a version of OpenMDAO that was not installed from an OpenMDAO repository using 'pip install -e'. I put a story in our bug tracker to fix it.

How to add a custom parser to logster?

I want to track the HTTP response codes returned by my nginx web-server, using logster.
1) I found and installed logster. I also pip-installed pygtail, which is required for logster.
https://github.com/etsy/logster
2) I found a python script that parses nginx access_log and placed it in the parsers subdir.
https://github.com/metabrainz/logster/blob/master/musicbrainz/logster/NginxStatus.py
...but when I run the logster command, I get a python exception:
Traceback (most recent call last):
File "/usr/local/bin/logster", line 5, in <module>
pkg_resources.run_script('logster==0.0.1', 'logster')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 505, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1245, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 449, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 380, in main
module = __import__(module_name, globals(), locals(), [parser_name])
ImportError: No module named NginxStatus1
````
What am I doing wrong?
The exception error was rather misleading: the file was placed in the right place (the parsers subdir), but - as it turns out- logster must be re-setup after a new parser is added (this isn't documented, unfortunately). so just run:
sudo python setup.py install
in the logster directory and things should start working correctly.

How to compile Google Closure code in modules using closure_builder.py?

How can I compile Google Closure code in multiple modules using closure_builder.py?
I tried this command:
python closurebuilder.py
--root closure/closure-library
--root closure/client
--namespace="client.start"
--output_mode=compiled
--compiler_jar=compiler.jar
--output_file closure/compiled.js
--compiler_flags=--compilation_level=ADVANCED_OPTIMIZATIONS
--compiler_flags=--module base:1
--compiler_flags=--js=closure/modules/base.js
--compiler_flags=--module editor:1
--compiler_flags=--js=closure/modules/editor.js
--compiler_flags=--module maps:1
--compiler_flags=--js=closure/modules/maps.js
--compiler_flags=--module uploader:1
--compiler_flags=--js=closure/modules/uploader.js
--compiler_flags=--module visualization:1
--compiler_flags=--js=closure/modules/visualization.js
--compiler_flags=--output_wrapper="(function() {%output%})();"
But the following error is thrown:
closurebuilder.py: Scanning paths...
Traceback (most recent call last):
File "closurebuilder.py", line 256, in <module>
main()
File "closurebuilder.py", line 196, in main
sources.add(_PathSource(js_path))
File "closurebuilder.py", line 167, in __init__
super(_PathSource, self).__init__(source.GetFileContents(path))
File "source.py", line 110, in GetFileContents
fileobj = open(path)
IOError: [Errno 2] No such file or directory: 'base:1'
I actually just ran into a similar issue, except that it wasn't 'base:1' but 'Files'. Turns out, i was executing the script from C:\Program Files (x86)... and those extra spaces messed with the Closure script and how it resolves JS files.
Executing it from a path with no space solved it, hope you can fix it as well, maybe try adding quotes over arguments
Fabien

funnelweb IndexError

I am trying to upload imported pages to plone using funnelweb. I have made a few posts regarding funnelweb, I guess I could mail the creators of the add-on to help solve this problem, but I think that others might need help with the same particular problem. Therefor it is more useful for everyone if the post is public, and not through mail :-)
Now to my problem. To upload the imported pages to plone, I have typed:
bin/funnelweb ploneupload:target://admin:password#localhost:8080/Wiki
I get the follwing error:
Traceback (most recent call last):
File "bin/funnelweb", line 116, in <module>
mr.migrator.runner.runner({},"funnelweb.remote")
File "/home/magiq/Plone/buildout-cache/eggs/mr.migrator-1.0.1-py2.7.egg/mr/migrator/runner/__init__.py", line 132, in runner
transmogrifier(pipelineid, **overrides)
File "/home/magiq/Plone/buildout-cache/eggs/collective.transmogrifier-1.3-py2.7.egg/collective/transmogrifier/transmogrifier.py", line 59, in __call__
pipeline = constructPipeline(self, sections)
File "/home/magiq/Plone/buildout-cache/eggs/collective.transmogrifier-1.3-py2.7.egg/collective/transmogrifier/utils.py", line 52, in constructPipeline
pipeline)
File "/home/magiq/Plone/buildout-cache/eggs/transmogrify.webcrawler-1.2.1-py2.7.egg/transmogrify/webcrawler/webcrawler.py", line 169, in __init__
if self.site_url[-1] != '/':
IndexError: string index out of range
Any suggestion about how to solve this? I guess it's a bug.
Does this add-on have a lot of bugs, or is it just that it doesn't do well with the newer version of plone?
You did not specify a source to funnel from. The error is thrown because there is no site url to crawl and upload.
Try:
bin/funnelweb --crawler:url=http://wiki.scandiatransplant.com --crawler:max=50 --ploneupload:target=http://admin:admin#localhost:8080/TestPage

Resources