I'm trying a simple code, just sending an ARP packet:
from scapy.all import *
p = ARP()
send(p)
and I get this error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
send(p)
File "C:\Python26\scapy\sendrecv.py", line 251, in send
__gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop,
count=count,verbose=verbose, realtime=realtime)
File "C:\Python26\scapy\sendrecv.py", line 234, in __gen_send
s.send(p)
File "C:\Python26\scapy\arch\pcapdnet.py", line 237, in send
ifs = dnet.eth(iff)
File "dnet.pyx", line 112, in dnet.eth.__init__
OSError: No error
My OS is windows 8 64bit. I tried in win7 64bit and got the same problem. I tried in win7 32bit and that works fine.
I can't understand why.. please help..
I guess you have to inform the interface ID, like this:
sendp(netpacket, iface='eth1')
I had the same trouble as yours, did like I said and got it!
Related
so I bought a thermal printer thinking I could use his usb port with python 3.9.7 to print with it but I get this error message:
c:/Users/gabpe/OneDrive/Documents/Python/Projet/Billing/TP_Test.py
Traceback (most recent call last):
File "c:\Users\gabpe\OneDrive\Documents\Python\Projet\Billing\TP_Test.py", line 6, in <module>
p = Usb(0x416, 0x5011)
File "C:\ProgramData\AnacondaML\lib\site-packages\escpos\printer.py", line 51, in __init__
self.open()
File "C:\ProgramData\AnacondaML\lib\site-packages\escpos\printer.py", line 68, in open
self.device.detach_kernel_driver(0)
File "C:\ProgramData\AnacondaML\lib\site-packages\usb\core.py", line 1121, in detach_kernel_driver
self._ctx.backend.detach_kernel_driver(
File "C:\ProgramData\AnacondaML\lib\site-packages\usb\backend\libusb0.py", line 662, in detach_kernel_driver
raise NotImplementedError(self.detach_kernel_driver.__name__)
NotImplementedError: detach_kernel_driver
This is the code I'm using for now:
from escpos.printer import Usb
TPrinter = Usb(0x416, 0x5011)
TPrinter.text("Please work\n")
TPrinter.close()
Just a basic thing to get me started. '0x416', '0x5011', '0x8', '0x1' this is my printer: idVendor, idProduct, address and bus. I'm using Windows 10 and I didn't install any driver for the thermal printer, which seems to be the problem as I saw on another post, but I don't know if I can do it without or if I need and driver or something and which driver to use, or maybe if there's another library I could use. Thx
I am trying to send data from a Pico Raspberry Pi to another Pico through an SX1262, but I can't send it.
I already tried the ping pong example, but the SX1262 library gives me errors in the Thonny IDE.
Traceback (most recent call last):
File "", line 19, in
File "/lib/sx1262.py", line 27, in begin
File "/lib/sx126x.py", line 115, in begin
File "/lib/sx126x.py", line 240, in reset
File "/lib/sx126x.py", line 389, in standby
File "/lib/sx126x.py", line 1270, in SPIwriteCommand
File "/lib/sx126x.py", line 1287, in SPItransfer
TypeError: object with buffer protocol required
Then we tried to use AT commands, but there is no response (code). We don't want to use LoRaWAN.
Can you please help if you found the solution?
I tried this and it works: try this
https://github.com/ehong-tl/micropySX126X
Hi I'm a beginner with Python and Scapy. When I try to use sendp() on a basic Layer 2 packet, I get a traceback error.
Using Python 3.8 and the latest development version of Scapy from https://scapy.readthedocs.io/en/latest/installation.html#platform-specific-instructions
This is what I'm inputting into the Python shell:
import scapy
from scapy.all import *
a=Ether()/IP(dst="www.google.ca")/ICMP()/"Hello world"
sendp(a)
This is the error message:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
sendp(a)
File "C:\Users\hoang\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.dev304758016-py3.8.egg\scapy\sendrecv.py", line 336, in sendp
results = __gen_send(socket, x, inter=inter, loop=loop,
File "C:\Users\hoang\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.dev304758016-py3.8.egg\scapy\sendrecv.py", line 296, in __gen_send
os.write(1, b".")
OSError: [Errno 9] Bad file descriptor
As pointed by #furas, this is indeed an issue with your console (IDLE?).
Scapy tries to display that the packet was sent, which fails.
You can always use
sendp(p, verbose=False)
To disable the logs, therefore working around the issue.
However I must say that if os.write(1, ..) was the only option back in the days, it's a bit outdated nowadays. This could probably be fixed on upstream.
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
I've been learning to use python in astronomy and for that I'm following this notes. In the very beginning the author does the following example:
>>> im = pyfits.getdata('http://das.sdss.org/www/cgi-bin/drC?RUN=3630&RERUN=40&CAMCOL=3&FIELD=83&FILTER=r')
>>> numdisplay.display(im,z1=1000,z2=1500)
I try to replicate it and I get:
>>> numdisplay.display(im,z1=1000,z2=1500)
Image displayed with Z1: 1000 Z2: 1500
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
numdisplay.display(im,z1=1000,z2=1500)
File "C:\Mine\Python\lib\site-packages\numdisplay\__init__.py", line 446, in display
_d.writeImage(bpix,_wcsinfo)
File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 513, in writeImage
self.writeData(_lx,_ydisp,_fpix[block,:])
File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 379, in writeData
self._writeHeader(opcode,self._MEMORY, -nbytes, x, y, frame, 0)
File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 542, in _writeHeader
self._write(a.tostring())
File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 580, in _write
nwritten = self._socket.send(s[-n:])
error: [Errno 10054] An existing connection was forced to close by the remote host
I don't understand what I'm doing wrong. I mean if I write numdisplay.open() everything is fine... I'm thinking that it might be my antivirus or something that doesn't let python to communicate with ds9... Can somebody help me?
Edit: Well it doesn't seem to be the antivirus. I stopped it and run the script and I got the same error.
I was getting similar error messages, and I just tried adding a non-'None' argument to the bufname argument and it works (my image is about 4096.4096):
numdisplay.display(data,bufname='imt4096')