Page 1 of 1

Python: subprocess.Popen not working

Posted: Sun Dec 16, 2012 12:45 pm
by marcus
It looks like the Popen function is not working in the system Python implementation:

Code: Select all

>>> subprocess.Popen(['echo','Hello world'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "PYTHON:Lib/subprocess.py", line 594, in __init__
    errread, errwrite)
  File "PYTHON:Lib/subprocess.py", line 101, in _execute_child
    self._set_cloexec_flag(errpipe_write)
  File "PYTHON:Lib/subprocess.py", line 973, in _set_cloexec_flag
    old = fcntl.fcntl(fd, fcntl.F_GETFD)
IOError: [Errno 78] Function not implemented
>>>
This is a problem for me becase hggit needs to use subprocess.Popen to run ssh when cloning/pushing a git+ssh URL.

Who is maintaining the Python port? Where is the source repository, and where can patches be sent?

Re: Python: subprocess.Popen not working

Posted: Mon Dec 17, 2012 2:51 am
by ssolie
Amiga Python is a part of AmigaOS and the source code is currently private. If you have any patches please free to send them to me.

Re: Python: subprocess.Popen not working

Posted: Mon Dec 17, 2012 10:43 pm
by marcus
Well, it's a bit difficult to produce patches to source code which is not available... :-/

Re: Python: subprocess.Popen not working

Posted: Tue Dec 18, 2012 12:02 am
by ssolie
marcus wrote:Well, it's a bit difficult to produce patches to source code which is not available... :-/
But it is available. All that stuff is just pure Python IIRC.

Re: Python: subprocess.Popen not working

Posted: Tue Dec 18, 2012 8:11 am
by marcus
No. The Python code needs to be changed for sure, but that's not where the magic happens. Currently there are two branches of the pure Python code for Popen. One for Posix, which uses fork and exec, and one for Windows which uses CreateProcess. For AmigaOS there needs to be a third branch which uses something AmigaOS-specific, but this AmigaOS-specific function needs to be implemented in C, just like fork, exec and CreateProcess (which are in the native module _subprocess).

Or do you mean that the AmigaOS Python port already exports some functionality to the pure Python level which could be used to implement Popen in lieu of fork/exec or CreateProcess? In that case I'd love a pointer to said functionality.