Python Forum
Xmodem error - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Xmodem error (/thread-21859.html)



Xmodem error - neethuvp - Oct-18-2019

Hi,
i have a program for transfer a file using 'Xmodem' protocol. My code is :
import select
import sys
from modem import XMODEM
def getc(size, timeout=5):
    r, w, e = select.select([sys.stdin.fileno()], [], [], timeout)
    if r: return sys.stdin.read(size)

def putc(data, timeout):
    r, w, e = select.select([], [sys.stdout.fileno()], [], timeout)
    if w: return sys.stdout.write(data)
xmodem = XMODEM(getc, putc)
stream = file("/home/gokul/Peer2Peer.bin")
xmodem.send(stream)
But when i run these code i got an error like "ImportError: No module named protocol.xmodem"

What is this error? How to solve this ?


RE: Xmodem error - buran - Oct-18-2019

Please, post full traceback in error tags, not just the last line


RE: Xmodem error - neethuvp - Oct-18-2019

This is the error
from modem import XMODEM
File "build/bdist.linux-x86_64/egg/modem/__init__.py", line 10, in <module>
ImportError: No module named protocol.xmodem



RE: Xmodem error - buran - Oct-18-2019

Try from xmodem import XMODEM


RE: Xmodem error - neethuvp - Oct-18-2019

Hi, i got the program error free. But now the file is not sending. But no error also . When i stop the code it shows like
r, w, e = select.select([sys.stdin.fileno()], [], [], timeout)
KeyboardInterrupt



is it a problem of timeout?


RE: Xmodem error - buran - Oct-18-2019

what python version do you use?


RE: Xmodem error - neethuvp - Oct-18-2019

i'm using Python 2.7.6