Python Forum

Full Version: Xmodem error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ?
Please, post full traceback in error tags, not just the last line
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
Try from xmodem import XMODEM
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?
what python version do you use?
i'm using Python 2.7.6