Python: subprocess.Popen not working

A forum for general AmigaOS 4.x support questions that are not platform-specific
Post Reply
marcus
Posts: 56
Joined: Wed Nov 07, 2012 8:07 pm

Python: subprocess.Popen not working

Post 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?
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: Python: subprocess.Popen not working

Post 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.
ExecSG Team Lead
marcus
Posts: 56
Joined: Wed Nov 07, 2012 8:07 pm

Re: Python: subprocess.Popen not working

Post by marcus »

Well, it's a bit difficult to produce patches to source code which is not available... :-/
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: Python: subprocess.Popen not working

Post 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.
ExecSG Team Lead
marcus
Posts: 56
Joined: Wed Nov 07, 2012 8:07 pm

Re: Python: subprocess.Popen not working

Post 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.
Post Reply