Send data between two pico with LoRa - python

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

Related

I can't seems to use my python code to print with my thermal printer

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

When I shutdown the Zope server it shows an AttributeError

I am using Plone 4.3.3 for creating my Plone site but when I shut-down the server it shows the following error.
Traceback (most recent call last):
File "/Plone/zinstance/parts/instance/bin/interpreter", line 298, in <module>
exec(compile(__file__f.read(), __file__, "exec"))
File "/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>
run()
File "/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 26, in run
starter.run()
File "/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 108, in run
self.shutdown()
File "/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 113, in shutdown
db.close()
File "/Plone/buildout-cache/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/ZODB/DB.py", line 624, in close
user#user-Vostro-3300:~/Plone/zinstance$ #self._connectionMap
File "/Plone/buildout-cache/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/ZODB/DB.py", line 506, in _connectionMap
self.pool.map(f)
File "/Plone/buildout-cache/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/ZODB/DB.py", line 206, in map
self.all.map(f)
File "/Plone/buildout-cache/eggs/transaction-1.1.1-py2.7.egg/transaction/weakset.py", line 58, in map
f(elt)
File "/Plone/buildout-cache/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/ZODB/DB.py", line 628, in _
c._release_resources()
File "/Plone/buildout-cache/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/ZODB/Connection.py", line 1075, in _release_resources
c._storage.release()
AttributeError: 'NoneType' object has no attribute 'release'
There is an issue with Zope2 shutdown that tries to close a database connection (and in turn, a storage). However, this late-running sequence has some cosmetic side-effect for users of RelStorage. This is annoying, but not fundamentally a problem that should cause any data integrity issues.
Users of FileStorage or ZEO should not see this.
References:
https://github.com/zopefoundation/Zope/commit/5032027470091957a6c0028da04c0fc0a1ed646b
https://mail.zope.org/pipermail/zodb-dev/2013-August/015119.html

Using TFTPY in python causing time out

I was trying to transfer a log file using tftp. For client side I am using TFTPY module in python. But it is showing below mentioned error messages.
WARNING:tftpy:Timeout waiting for traffic, retrying...
ERROR:tftpy:Timed-out waiting for traffic
WARNING:tftpy:resending last packet
WARNING:tftpy:Resending packet RRQ packet: filename = /opt/TDK/logs//55194186195512_Console.log mode = octet on sessions <tftpy.TftpStates.TftpStateSentRRQ object at 0xb70a0f8c>
Traceback (most recent call last):
File "callConsoleLogTransfer.py", line 30, in <module>
consoleLogTransfer(IP,Port,logTransferPort,fileName,localFilePath)
File "/file/consoleLogTransfer.py", line 68, in consoleLogTransfer
client.download( remoteFile, localFile, timeout=20 )
File "/usr/local/lib/python2.7/dist-packages/tftpy/TftpClient.py", line 52, in download
self.context.start()
File "/usr/local/lib/python2.7/dist-packages/tftpy/TftpContexts.py", line 378, in start
self.state.resendLast()
File "/usr/local/lib/python2.7/dist-packages/tftpy/TftpStates.py", line 203, in resendLast
(self.context.host, self.context.tidport))
TypeError: an integer is required

Using numdisplay, "An existing connection was forced to close by the remote host"

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')

Scapy won't send packets in 64 bit Windows

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!

Categories

Resources