kann keine pipe erstellen
Verfasst: Mittwoch 27. Februar 2008, 14:13
Ich will eine "named pipe" erstellen mit python und etwas reinschreiben. Das Problem ist das sich python aufhängt bzw. einfriert wenn ich das machen will.
als testcode habe ich mal einen code von http://my.opera.com/zomg/blog/2007/0...nd-named-pipes genommen:
zum start gebe ich einfach "python pipe.py" ein und das Programm bleibt genau beim open befehl stehen und macht nichts mehr und lässt sich nur mit CTR-C beenden:
als testcode habe ich mal einen code von http://my.opera.com/zomg/blog/2007/0...nd-named-pipes genommen:
Code: Alles auswählen
import os
# the name of the pipe
pipeName = 'testpipe'
# we will get an error if the pipe exists
# when creating a new one, so try removing it first
try:
os.unlink(pipeName)
except:
pass
# create the pipe and open it for reading
os.mkfifo(pipeName)
pipe = open(pipeName,'r')
# read forever and print anything written to the pipe
while True:
data = pipe.readline()
if data != '':
print repr(data)
zum start gebe ich einfach "python pipe.py" ein und das Programm bleibt genau beim open befehl stehen und macht nichts mehr und lässt sich nur mit CTR-C beenden:
Code: Alles auswählen
$ python pipe.py
Traceback (most recent call last):
File "pipe.py", line 15, in <module>
pipe = open(pipeName,'r')