scapy OSError: [Errno 9] Bad file descriptor
same error as this guy . using python 2.7.5 on windows.downloded all the extentions and followed everything step by step. still doesnt seem to work. every function i try wheter it's sr1 or send or anything else i get this error OSError: [Errno 9] Bad file descriptor..
and it mentiones lines in some of the scapy scripts (scapy\sendrecv.pyc as example..)
the simplest things i try running in the interpreter doesnt work. as in :
from scapy.all import *
p=sr1(IP(dst='190.200.2.5')/ICMP())
so i tried reinstalling this time everything according to the guide they provide int the website and using python 2.6 , same results ..
>>> p=sr1(IP(dst='192.168.1.1')/ICMP())
ERROR: --- Error sending packets
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\scapy\arch\windows\__init__.py", line 374, in sndrcv
pks.send(p)
File "C:\Python26\lib\site-packages\scapy\arch\pcapdnet.py", line 237, in send
ifs = dnet.eth(iff)
File "dnet.pyx", line 112, in dnet.eth.__init__
OSError: Result too large
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
p=sr1(IP(dst='192.168.1.1')/ICMP())
File "C:\Python26\lib\site-packages\scapy\sendrecv.py", line 335, in sr1
a,b=sndrcv(s,x,*args,**kargs)
File "C:\Python26\lib\site-packages\scapy\arch\windows\__init__.py", line 431, in sndrcv
os.write(1, ".")
OSError: [Errno 9] Bad file descriptor
Related
I was building a Rich Presence application and it worked totally fine until today. When I ran the code today it no longer worked and I get a error, mind you I didn't change a single bit of code. Does anyone know what could the problem be? I have attached the error. Also I ran the code as admin and it worked but it doesn't show the Rich Presence.
Error:
Traceback (most recent call last):
File "c:\Users\MyName\Desktop\DiscoRP v2\main.py", line 11, in <module>
from applet import quotegen
File "c:\Users\MyName\Desktop\DiscoRP v2\applet\quotegen.py", line 11, in <module>
connectionManager.connection(RPC)
File "c:\Users\MyName\Desktop\DiscoRP v2\config\connectionManager.py", line 5, in connection
RPC.connect()
File "C:\Users\MyName\AppData\Local\Programs\Python\Python39\lib\site-packages\pypresence\presence.py", line 43, in connect
self.loop.run_until_complete(self.handshake())
File "C:\Users\MyName\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\MyName\AppData\Local\Programs\Python\Python39\lib\site-packages\pypresence\baseclient.py", line 134, in handshake
self.sock_writer, _ = await self.loop.create_pipe_connection(lambda: reader_protocol, self.ipc_path)
File "C:\Users\MyName\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 333, in create_pipe_connection
pipe = await f
File "C:\Users\MyName\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 652, in connect_pipe
handle = _overlapped.ConnectPipe(address)
PermissionError: [WinError 5] Access is denied
What Am I supposed to do?
Because can't see your code, maybe you can check this PermissionError: [WinError 5] Access is denied
Someone's solution looks like to modify the path of the file.
I am trying to set up the ChirpSDK, but every time I configure and run the code, I get this error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
chirp = ChirpSDK()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 395, in __init__
self.read_chirprc(block)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 501, in read_chirprc
raise IOError('Could not find a ~/.chirprc file')
OSError: Could not find a ~/.chirprc file
Exception ignored in: <function ChirpSDK.__del__ at 0x10fa31af0>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 422, in __del__
self.close()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 470, in close
if self._sdk:
AttributeError: 'ChirpSDK' object has no attribute '_sdk'
I realize that the error is saying that my .chirprc file is not being recognized, but I have no idea how to remedy this. I created a .chirprc file in my /Users/username/ path, and named it c.chirprc (as the Chirp getting started article suggests), but I am still getting this error. Is there another part that I am missing? Am I reading the instructions wrong?
Thanks
The Chirp configuration file should be placed at /Users/<username>/.chirprc on macOS.
If you run ls -l ~/.chirprc in the terminal, do you get any results? If it displays no such file or directory then you have not created the file correctly.
I'm new to Python and self-teaching myself neural networks from this http://neuralnetworksanddeeplearning.com/chap1.html and I'm having trouble importing the files that I've downloaded for the exercises. This is the error message I keep getting:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
File "mnist_loader.py", line 68, in load_data_wrapper
File "mnist_loader.py", line 42, in load_data
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 34, in open
return GzipFile(filename, mode, compresslevel)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 94, in __init__
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: [Errno 2] No such file or directory: '../data/mnist.pkl.gz'
I've looked around and tried this:
>>> open('Users/bryanjordan/Documents/neural-networks-and-deep-learning-master/mnist.pkl')
but get this error:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
open('Users/bryanjordan/Documents/neural-networks-and-deep-learning-master/mnist.pkl')
IOError: [Errno 2] No such file or directory: 'Users/bryanjordan/Documents/neural-networks-and-deep-learning-master/mnist.pkl'
I also meet this question. And I find the solution to solve this problem.
If you run the code in the python console, please first use "cd" into the "/src" folder, and run the code.
If you run the code in a python file (like me), you should put the file into the "/src" folder.
It will be solved. The only reason is that the relative path. You should stand in the right place.
Hope to help you.
I've still not been able to resolve this problem, after working on it for a week.
I'm thinking of giving up and just running theano on a virutal machine; there just doesn't seem to be any support out there for Windows 10!
Or am I wrong; is there an easy fix to this?
>>> import theano
Traceback (most recent call last):
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\lazylinker_c.py", line 75, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\lazylinker_c.py", line 92, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\cmodule.py", line 1784, in _try_compile_tmp
os.remove(exe_path + ".exe")
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\cturn\\AppData\\Local\\Temp\\try_march_3v6ffkv9.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\__init__.py", line 66, in <module>
from theano.compile import (
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\compile\__init__.py", line 10, in <module>
from theano.compile.function_module import *
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\compile\function_module.py", line 21, in <module>
import theano.compile.mode
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\compile\mode.py", line 10, in <module>
import theano.gof.vm
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\vm.py", line 659, in <module>
from . import lazylinker_c
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\lazylinker_c.py", line 125, in <module>
args = cmodule.GCC_compiler.compile_args()
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\cmodule.py", line 2088, in compile_args
default_compilation_result, default_execution_result = try_march_flag(GCC_compiler.march_flags)
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\cmodule.py", line 1856, in try_march_flag
flags=cflags, try_run=True)
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\cmodule.py", line 2188, in try_compile_tmp
comp_args)
File "C:\Users\cturn\Anaconda3\lib\site-packages\theano\theano\gof\cmodule.py", line 1789, in _try_compile_tmp
err += "\n" + str(e)
TypeError: can't concat bytes to str
Um, can't concat bytes to str? What does this mean?
The error you are experiencing appears to result from another sub-process utilizing the same resources as the script you are attempting to write. Although it sounds trivial, I would recommend making sure that you have admin privileges, or at least privileges to the desired resources, and/or restart your computer to kill the sub-process using that module. You could also look in the task manager and kill any/all other processes using python, but that might take longer.
(This may be the program using the "resource" try_march_3v6ffkv9.exe)
I am working with large matrixes, so I am using NumPy's memmap. However, I am getting an error as apparently the file descriptors used by memmap are not being closed.
import numpy
import tempfile
counter = 0
while True:
temp_fd, temporary_filename = tempfile.mkstemp(suffix='.memmap')
map = numpy.memmap(temporary_filename, dtype=float, mode="w+", shape=1000)
counter += 1
print counter
map.close()
os.remove(temporary_filename)
From what I understand, the memmap file is closed when the method close() is called. However, the code above cannot loop forever, as it eventually throws the "[Errno 24] Too many open files" error:
1016
1017
1018
1019
Traceback (most recent call last):
File "./memmap_loop.py", line 11, in <module>
File "/usr/lib/python2.5/site-packages/numpy/core/memmap.py", line 226, in __new__
EnvironmentError: [Errno 24] Too many open files
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/apport_python_hook.py", line 38, in apport_excepthook
ImportError: No module named packaging_impl
Original exception was:
Traceback (most recent call last):
File "./memmap_loop.py", line 11, in <module>
File "/usr/lib/python2.5/site-packages/numpy/core/memmap.py", line 226, in __new__
EnvironmentError: [Errno 24] Too many open files
Does anybody know what I am overlooking?
Since the memmap does not take the open file descriptor, but the file name, I suppose you leak the temp_fd file descriptor. Does os.close(temp_fd) help?
Great that it works.
Since you can pass numpy.memmap a file-like object, you could create one from the file descriptor you already have, temp_fd.
fobj = os.fdopen(temp_fd, "w+")
numpy.memmap(fobj, ...