ironpython2 icon indicating copy to clipboard operation
ironpython2 copied to clipboard

Starting a Process fails with Attribute Error: WNOHANG not found

Open VinayGupta23 opened this issue 8 years ago • 7 comments

Starting a Process fails with Attribute Error: WNOHANG not found.

Example:

Example souce code used (refer docs):

from multiprocessing import Process
import os

def f(name):
    print 'hello', name

if __name__ == '__main__':
    p = Process(target=f, args=('bob',))
    p.start()
    p.join()

Output:

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\multiprocessing\process.py", line 129, in start
  File "C:\Program Files (x86)\IronPython 2.7\Lib\multiprocessing\forking.py", line 114, in <module>
AttributeError: 'module' object has no attribute 'WNOHANG'

I am using IronPython's latest version: IronPython 2.7.7 (2.7.7.0) on .NET 4.0.30319.42000 (64-bit) My OS is a Windows 10 Enterprise.

NOTE: The same code executes without error on Python 2.7.13, with version: Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32

I am looking forward to using IronPython extensively, and any support on this would be great.

Thanks, Vinay

VinayGupta23 avatar Sep 03 '17 13:09 VinayGupta23

Multiprocessing is not currently supported on IronPython

slide avatar Sep 03 '17 14:09 slide

Oh, unfortunate to hear.

Is there is any plan to implement it in the near future or an alternative?

So as I understand the libraries are merely ported but not yet implemented for .NET?

Regards, Vinay


From: Alex Earl [email protected] Sent: Sunday, September 3, 2017 7:47:13 PM To: IronLanguages/ironpython2 Cc: Vinay Gupta; Author Subject: Re: [IronLanguages/ironpython2] Starting a Process fails with Attribute Error: WNOHANG not found (#236)

Multiprocessing is not currently supported on IronPython

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/IronLanguages/ironpython2/issues/236#issuecomment-326807671, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIdrSb7iPv9uWFOuyZF1m--B6l4vJd0Zks5serTpgaJpZM4PLMMG.

VinayGupta23 avatar Sep 03 '17 14:09 VinayGupta23

I hope I am not trivializing anything, but multiprocessing looks like low hanging fruit. It is full of sys.platform checks, which in case of ironpython take unix instead of windows implementation.

On Sun, Sep 3, 2017 at 4:42 PM, Vinay Gupta [email protected] wrote:

Oh, unfortunate to hear.

Is there is any plan to implement it in the near future or an alternative?

Regards, Vinay


From: Alex Earl [email protected] Sent: Sunday, September 3, 2017 7:47:13 PM To: IronLanguages/ironpython2 Cc: Vinay Gupta; Author Subject: Re: [IronLanguages/ironpython2] Starting a Process fails with Attribute Error: WNOHANG not found (#236)

Multiprocessing is not currently supported on IronPython

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<https://github.com/ IronLanguages/ironpython2/issues/236#issuecomment-326807671>, or mute the thread<https://github.com/notifications/unsubscribe- auth/AIdrSb7iPv9uWFOuyZF1m--B6l4vJd0Zks5serTpgaJpZM4PLMMG>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IronLanguages/ironpython2/issues/236#issuecomment-326809140, or mute the thread https://github.com/notifications/unsubscribe-auth/ABix4DFKxGxP1M8wUZ_XrPr_Lhxg-G2Bks5serrMgaJpZM4PLMMG .

paweljasinski avatar Sep 03 '17 15:09 paweljasinski

I didn't quite understand what you're implying, and perhaps you could add more perspective to it.

Anyhow, I'll add some context to my problem. I need to load multiple instances of a DLL in my program, which is only permitted on different processes in Windows.

This is required as the DLL provides a UDP connection to some server, and due to limitations of the DLL (that I didn't write), I cannot connect to multiple ports concurrently on the same DLL instance.

Regards, Vinay


From: Pawel Jasinski [email protected] Sent: Sunday, September 3, 2017 8:39:07 PM To: IronLanguages/ironpython2 Cc: Vinay Gupta; Author Subject: Re: [IronLanguages/ironpython2] Starting a Process fails with Attribute Error: WNOHANG not found (#236)

I hope I am not trivializing anything, but multiprocessing looks like low hanging fruit. It is full of sys.platform checks, which in case of ironpython take unix instead of windows implementation.

On Sun, Sep 3, 2017 at 4:42 PM, Vinay Gupta [email protected] wrote:

Oh, unfortunate to hear.

Is there is any plan to implement it in the near future or an alternative?

Regards, Vinay


From: Alex Earl [email protected] Sent: Sunday, September 3, 2017 7:47:13 PM To: IronLanguages/ironpython2 Cc: Vinay Gupta; Author Subject: Re: [IronLanguages/ironpython2] Starting a Process fails with Attribute Error: WNOHANG not found (#236)

Multiprocessing is not currently supported on IronPython

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<https://github.com/ IronLanguages/ironpython2/issues/236#issuecomment-326807671>, or mute the thread<https://github.com/notifications/unsubscribe- auth/AIdrSb7iPv9uWFOuyZF1m--B6l4vJd0Zks5serTpgaJpZM4PLMMG>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IronLanguages/ironpython2/issues/236#issuecomment-326809140, or mute the thread https://github.com/notifications/unsubscribe-auth/ABix4DFKxGxP1M8wUZ_XrPr_Lhxg-G2Bks5serrMgaJpZM4PLMMG .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/IronLanguages/ironpython2/issues/236#issuecomment-326810613, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIdrSUKAVa9xCSmJwQihbWZVLc_h29wNks5sesESgaJpZM4PLMMG.

VinayGupta23 avatar Sep 04 '17 03:09 VinayGupta23

@VinayGupta23: I believe what @paweljasinski is saying is that there are a number of if sys.platform == 'win32' checks in the multiprocessing source file that should be changed to something like if sys.platform == 'win32' or (sys.platform == 'cli' and os.name == 'nt') to work with IronPython. These changes may (or may not) get the multiprocessing module up and running. PRs are welcome.

slozier avatar Sep 04 '17 13:09 slozier

@paweljasinski There is a native module (_multiprocessing) that needs to be implemented as well I believe.

slide avatar Sep 05 '17 21:09 slide

Multiprocessing isn't as important on IronPython since we don't have the GIL. You can still get usage of all cores in the system by using just the threading module on IronPython because the implementation underneath is the .NET framework, which will run on all processors and not have the GIL in play.

slide avatar Jul 11 '18 05:07 slide