Python Forum
problems sending BIN file with XMODEM python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems sending BIN file with XMODEM python
#1
Hello my freinds,


i am trying to send a bin file which i already tested with teraterm before.
the reciever is an energy meter, i am connected to it by usb/rs232 converter.

when i start the XMODEM i recieve the following error:

*Read Byte: b'\x00'

send error: expected NAK, CRC, or CAN; got b'\x00'*



can anyone please help?

i am using the following code:

def sendFile():

    ser= serialPort.serialport
    ser.flushInput()
    print (ser)

def getc(size, timeout=8):
    gbytes = ser.read(size)
    sleep(2)
    print(f'Read Byte: {gbytes}')
    return gbytes or None


def putc(data, timeout=8):
    pbytes = ser.write(data)
    sleep(2)
    print(f'Put Byte: {pbytes}')
    return pbytes or None

modem =XMODEM(getc,putc)
stream = open('104_new.BIN', 'rb')
modem.send(stream)
print(stream)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Sad problems with reading csv file. MassiJames 3 559 Nov-16-2023, 03:41 PM
Last Post: snippsat
  Sending Whatsapp Message in the text file ebincharles869 9 3,396 Jun-21-2022, 04:26 PM
Last Post: snippsat
  Upgrading from 2 to 3 and having file write problems KenHorse 2 1,430 May-08-2022, 09:47 PM
Last Post: KenHorse
Question Debian 11 Bullseye | Python 3.9.x | pip install mysql-connector-python-rf problems BrandonKastning 4 6,574 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  Sending string commands from Python to a bluetooth device Rovelin 13 9,282 Aug-31-2021, 06:40 PM
Last Post: deanhystad
  Problems with inserting images into an Excel File FightingFarmer 2 3,362 May-12-2021, 10:03 PM
Last Post: FightingFarmer
  Progress Indicator for Xmodem 0.4.6 KenHorse 1 1,931 Jan-30-2021, 07:12 PM
Last Post: bowlofred
  Problems Sorting Data in an External File (.txt) Superlegend21 1 4,286 Dec-27-2020, 10:06 PM
Last Post: Superlegend21
  how to automate sending bulk emails from an excel file or a calc-file apollo 0 2,709 Dec-10-2020, 08:43 PM
Last Post: apollo
  Sending Out Email via Python JoeDainton123 1 4,699 Aug-31-2020, 12:54 AM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020