Using TFTPY in python causing time out - python

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

Related

Send data between two pico with LoRa

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

Add GPS to Your Raspberry Pi Project with Google Maps Pubnub

(I'm following this tutorial : https://www.pubnub.com/blog/raspberry-pi-gps-lte-google-maps-api/ and I use a Raspberry pi 4 model B connected trough wifi )
I carefully followed all steps carefully untill I tried to run the modified gps_simpletest.py file. When I try to run it I get the following error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 323, in _rec onfigure_port
orig_attr = termios.tcgetattr(self.fd)
termios.error: (5, 'Input/output error')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "gps_simpletest.py", line 21, in <module>
uart = serial.Serial("/dev/ttyS0", baudrate=9600, timeout=10)
File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 240, in __ini t__
self.open()
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 272, in open
self._reconfigure_port(force_update=True)
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 326, in _rec onfigure_port
raise SerialException("Could not configure port: {}".format(msg))
serial.seria
I'm pretty sure I installed all modules, libraries, ....
Any help would be much appreciated!Thanks in advance

Why scapy gives an error after running for some time?

I am using scapy to send arp packets to my another computer in LAN it runs for sometimes and sends some packets but after that scapy stops with an error.
Sent Packets: 28Traceback (most recent call last):
File "main.py", line 33, in <module>
spoof('192.168.43.65', '192.168.43.1')
File "main.py", line 15, in spoof
target_mac = get_mac(target_ip)
File "main.py", line 11, in get_mac
return answered[0][1].hwsrc
File "/usr/lib/python3/dist-packages/scapy/plist.py", line 118, in __getitem__
return self.res.__getitem__(item)
IndexError: list index out of range
def spoof(target_ip, source_ip):
target_mac = get_mac(target_ip)
packet = scapy.ARP(op=2, pdst=target_ip, hwdst=target_mac, psrc=source_ip)
scapy.send(packet, verbose=False)
This is my function I am running it in a while loop infinitely.
Why am I getting this error?

read_raw throws timeout error when communicating with tektronix oscilloscope using pyvisa package

I am trying to read raw data using pyvisa which communicates with MDO3014 oscilloscope.
The code I have tried is as follows:-
import pyvisa
rm = pyvisa.ResourceManager()
usb = rm.list_resources()[0]
my_instrument = rm.open_resource(usb)
print(my_instrument.query('*IDN?'))
my_instrument.timeout = 25000
my_instrument.write('SAVE:IMAGe:FILEF PNG')
my_instrument.write('HARDCOPY:START')
raw_data = my_instrument.read_raw()
I am getting timeout error, the traceback of error logs is as follows:-
('USB0::0x0699::0x0408::C031378::INSTR', 'ASRL1::INSTR', 'ASRL3::INSTR')
TEKTRONIX,MDO3014,C031378,CF:91.1CT FV:v1.30
Traceback (most recent call last):
File "waveform_capture.py", line 14, in <module>
raw_data = my_instrument.read_raw()
File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\resources\messagebased.py", line 405, in read_raw
return bytes(self._read_raw(size))
File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\resources\messagebased.py", line 442, in _read_raw
chunk, status = self.visalib.read(self.session, size)
File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\ctwrapper\functions.py",
line 2337, in read
ret = library.viRead(session, buffer, count, byref(return_count))
File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\ctwrapper\highlevel.py",
line 222, in _return_handler
return self.handle_return_value(session, ret_value) # type: ignore
File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\highlevel.py", line 251,
in handle_return_value
raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.

Cannot create simple table using Happybase in Python

I am trying to create a table using Happybase. To start I enter the following commands get Hbase and Thrift running:
start-hbase.sh
hbase thrift start &
Once this is running I open Python's command prompt and type the following:
import happybase as hb
connection = hb.Connection()
connection.open()
However when I try to create a table:
connection.create_table(
'mytable',
{'cf1': dict(max_versions=10),
'cf2': dict(max_versions=1, block_cache_enabled=False),
'cf3': dict(), # use defaults
}
I get the following error that I just don't understand.
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "/usr/local/lib/python2.7/dist-packages/happybase/connection.py", line 309, in create_table
self.client.createTable(name, column_descriptors)
File "/usr/local/lib/python2.7/dist-packages/thriftpy/thrift.py", line 198, in _req
return self._recv(_api)
File "/usr/local/lib/python2.7/dist-packages/thriftpy/thrift.py", line 210, in _recv
fname, mtype, rseqid = self._iprot.read_message_begin()
File "thriftpy/protocol/cybin/cybin.pyx", line 429, in cybin.TCyBinaryProtocol.read_message_begin (thriftpy/protocol/cybin/cybin.c:6325)
File "thriftpy/protocol/cybin/cybin.pyx", line 60, in cybin.read_i32 (thriftpy/protocol/cybin/cybin.c:1546)
File "thriftpy/transport/buffered/cybuffered.pyx", line 65, in thriftpy.transport.buffered.cybuffered.TCyBufferedTransport.c_read (thriftpy/transport/buffered/cybuffered.c:1881)
File "thriftpy/transport/buffered/cybuffered.pyx", line 69, in thriftpy.transport.buffered.cybuffered.TCyBufferedTransport.read_trans (thriftpy/transport/buffered/cybuffered.c:1948)
File "thriftpy/transport/cybase.pyx", line 61, in thriftpy.transport.cybase.TCyBuffer.read_trans (thriftpy/transport/cybase.c:1472)
File "/usr/local/lib/python2.7/dist-packages/thriftpy/transport/socket.py", line 125, in read
message='TSocket read 0 bytes')
thriftpy.transport.TTransportException: TTransportException(message='TSocket read 0 bytes', type=4)
)
You need to specify the server address, and possibly port:
connection = hb.Connection(SERVER, PORT)
You can probably omit the port value, as most likely the default value will match, but just in case check on what port your thrift server is listening and specify that as a numeric value

Categories

Resources