Python Forum

Full Version: does open() still take file descriptors in py3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am trying to open a file descriptor (an end of a pipe from os.pipe()) using open().
i get a funny error message and execution continues.
Output:
Traceback (most recent call last):   File "blist.py", line 53, in <module>     result = main( argv )   File "blist.py", line 47, in main     pipeline.run( cmds, stdout=1 )   File "/root/pipeline.py", line 180, in run     start( commands, stdin=stdin, stdout=stdout )   File "/root/pipeline.py", line 156, in start     rfdw = open(rfdw,'w') TypeError: coercing to Unicode: need string or buffer, int found ^CError in atexit._run_exitfuncs: lt1/forums /home/forums 75>
any idea what is happening?  yes, rfdw is an int. it is supposed to work.  it did work.  execution continued after the exception and the expected listing came out just fine and correct.  using python 3.5.2.
Not much help we can give you without seeing code.
Here's a stack overflow post on the error: http://stackoverflow.com/questions/27274...-int-found

You probably already know that. Didn't look at your user name before posting answer
it's big code.  i can try to minimize it and post the minimized.  i am just wonder if there is something going on with open(), especially with open() using fd's.   or if maybe i should switch to os.fdopen() which only accepts an int.  i am just try to get an understanding of what the error message means, not debug the code (yet).

that and understand why it continued to run.

i thought out why it probably continued to run. the error was in the parent process and the children continued on.