Python Forum
does open() still take file descriptors in py3
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
does open() still take file descriptors in py3
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#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
Reply
#3
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Open/save file on Android frohr 0 315 Jan-24-2024, 06:28 PM
Last Post: frohr
  problem descriptors in Python akbarza 8 1,014 Dec-27-2023, 09:01 PM
Last Post: deanhystad
  file open "file not found error" shanoger 8 1,087 Dec-14-2023, 08:03 AM
Last Post: shanoger
  How can i combine these two functions so i only open the file once? cubangt 4 852 Aug-14-2023, 05:04 PM
Last Post: snippsat
  I cannot able open a file in python ? ted 5 3,298 Feb-11-2023, 02:38 AM
Last Post: ted
  testing an open file Skaperen 7 1,359 Dec-20-2022, 02:19 AM
Last Post: Skaperen
  I get an FileNotFouerror while try to open(file,"rt"). My goal is to replace str decoded 1 1,400 May-06-2022, 01:44 PM
Last Post: Larz60+
  Dynamic File Name to a shared folder with open command in python sjcsvatt 9 6,023 Jan-07-2022, 04:55 PM
Last Post: bowlofred
  Open an excel file Newbie1114 1 2,332 Jun-16-2021, 09:11 PM
Last Post: Gribouillis
  How to open MIDI-file and get events in a list? philipbergwerf 7 4,960 May-29-2021, 08:24 AM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020