I want to create a named pipe with python and write to it. But Python seems so freez everytime i want to open a pipe.
my code (exampel code found on http://my.opera.com/zomg/blog/2007/08/29/php-and-named-pipes):
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)
i try to run it "python pipe.py" and pyton creates the pipe correctly but after calling "pipe = open(pipeName,'r')" it just stops/freezes and i can do nothing. What's the Problem? Can andyone help me?
my code (exampel code found on http://my.opera.com/zomg/blog/2007/08/29/php-and-named-pipes):
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)
i try to run it "python pipe.py" and pyton creates the pipe correctly but after calling "pipe = open(pipeName,'r')" it just stops/freezes and i can do nothing. What's the Problem? Can andyone help me?