Re: [IronPython] multiprocessing in 2.7
Hi Markus, Thanks for your answer. I already know that and I have started to develop my solution based on threading module. But, there is always a but, I'm working with WebBrowser and I want to run multi concurrent instances and each instance must have its own session. Unfortunately to get a session independence for each WebBrowser instance I need to get a process per instance :(. That's why I need to use multiprocess module. Maybe someone can help me to find a way to get session isolation without multiprocess usage? Thanks, Romain 2011/3/24 Markus Schaber > Hi, Romain, > > Romain Gilles wrote: > > from multiprocessing import Process > > A small remark: > The main usage of the multiprocessing module is to work around the global > interpreter lock (GIL) in cPython. > > As IronPython does not have that GIL, maybe you can create a scalable > application just fine without the multiprocessing module, maybe using the > .NET ThreadPools > > Grüße, > Markus > ___ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] multiprocessing in 2.7
Hi, Romain, Romain Gilles wrote: > from multiprocessing import Process A small remark: The main usage of the multiprocessing module is to work around the global interpreter lock (GIL) in cPython. As IronPython does not have that GIL, maybe you can create a scalable application just fine without the multiprocessing module, maybe using the .NET ThreadPools Grüße, Markus ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] multiprocessing in 2.7
Thanks Jeff for the information. I will be really please to help you but I'm a dummy in C#, C++, Python and Windows :( Romain. 2011/3/23 Jeff Hardy > On Wed, Mar 23, 2011 at 7:19 AM, Romain Gilles > wrote: > > but who can I add to my IronPython the _multiprocessing module ? > > -- > > c:\temp>ipy test-ipy-multiprocessing.py > > Traceback (most recent call last): > > File "test-ipy-multiprocessing.py", line 1, in > > File "c:\Program Files\IronPython > > 2.7\lib\site-packages\multiprocessing\__init__.py", line 83, in > > ImportError: No module named _multiprocessing > > -- > > Maybe It cannot be resolved that way. > > Unfortunately, no one has written an IronPython version of > _multiprocessing, so it's not supported. It's probably one of the > trickiest remaining modules to support, so contributions are welcome, > as always. > > - Jeff > > - Jeff > ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] multiprocessing in 2.7
On Wed, Mar 23, 2011 at 7:19 AM, Romain Gilles wrote: > but who can I add to my IronPython the _multiprocessing module ? > -- > c:\temp>ipy test-ipy-multiprocessing.py > Traceback (most recent call last): > File "test-ipy-multiprocessing.py", line 1, in > File "c:\Program Files\IronPython > 2.7\lib\site-packages\multiprocessing\__init__.py", line 83, in > ImportError: No module named _multiprocessing > -- > Maybe It cannot be resolved that way. Unfortunately, no one has written an IronPython version of _multiprocessing, so it's not supported. It's probably one of the trickiest remaining modules to support, so contributions are welcome, as always. - Jeff - Jeff ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] multiprocessing in 2.7
Ok, I have patched the corresponding line: 19a20 > from System.Text import UTF8Encoding 283c284,288 < self._authkey = AuthenticationString(os.urandom(32)) --- > bytes = os.urandom(32) > encoding=UTF8Encoding() > if isinstance(bytes, str): > bytes = encoding.GetBytes(bytes) > self._authkey = AuthenticationString(bytes) but who can I add to my IronPython the _multiprocessing module ? -- c:\temp>ipy test-ipy-multiprocessing.py Traceback (most recent call last): File "test-ipy-multiprocessing.py", line 1, in File "c:\Program Files\IronPython 2.7\lib\site-packages\multiprocessing\__init__.py", line 83, in ImportError: No module named _multiprocessing -- Maybe It cannot be resolved that way. Regards, Romain 2011/3/23 Davy Mitchell > If it is a 'C' based extension then it won't directly work with IronPython. > > Maybe someone has a workaround / alternative? > > Cheers, > Davy > > On 23 March 2011 10:23, Romain Gilles wrote: > > Hi, > > First of all thanks for your answer :). But after updated > > my IRONPYTHONPATH as follow: > > set IRONPYTHONPATH=c:\Python27\Lib > > I get this error: > > - > > c:\temp>ipy test-ipy-multiprocessing.py > > Traceback (most recent call last): > > File "test-ipy-multiprocessing.py", line 1, in > > File "c:\Python27\Lib\multiprocessing\__init__.py", line 63, in > > > File "c:\Python27\Lib\multiprocessing\process.py", line 286, in > > > File "c:\Python27\Lib\multiprocessing\process.py", line 283, in > __init__ > > TypeError: expected IList[Byte], got str > > - > > 2011/3/23 Oleksii Bidiuk > >> > >> Hi Romain, > >> AFAIK you have to download the Python standard library separately. See > >> e.g. > http://www.ironpython.info/index.php/Using_the_Python_Standard_Library for > >> examples (I've done it a while ago, so had to Google around a bit). > >> > >> 2011/3/23 Romain Gilles > >>> > >>> Hi all, > >>> I'm trying to use this feature in ironpython. I just follow the first > >>> sample: > >>> > >>> from multiprocessing import Process > >>> def f(name): > >>> print 'hello', name > >>> if __name__ == '__main__': > >>> p = Process(target=f, args=('bob',)) > >>> p.start() > >>> p.join() > >>> > >>> But I get the following error when I'm executing it: > >>> > >>> c:\temp>ipy test-ipy-multiprocessing.py > >>> Traceback (most recent call last): > >>> File "test-ipy-multiprocessing.py", line 1, in > >>> ImportError: No module named multiprocessing > >>> > >>> Thanks for any help. > >>> Regards. > >>> Romain. > >>> PS: I have just installed the last release of IronPython 2.7 > >>> > >>> c:\temp>ipy -V > >>> PythonContext 2.7.0.40 on .NET 4.0.30319.1 > >>> > >>> ___ > >>> Users mailing list > >>> Users@lists.ironpython.com > >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >>> > >> > >> > >> > >> -- > >> oleksii > > > > > > ___ > > Users mailing list > > Users@lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > -- > -- > Davy's Blog - http://daftspaniel.wordpress.com > ___ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] multiprocessing in 2.7
If it is a 'C' based extension then it won't directly work with IronPython. Maybe someone has a workaround / alternative? Cheers, Davy On 23 March 2011 10:23, Romain Gilles wrote: > Hi, > First of all thanks for your answer :). But after updated > my IRONPYTHONPATH as follow: > set IRONPYTHONPATH=c:\Python27\Lib > I get this error: > - > c:\temp>ipy test-ipy-multiprocessing.py > Traceback (most recent call last): > File "test-ipy-multiprocessing.py", line 1, in > File "c:\Python27\Lib\multiprocessing\__init__.py", line 63, in > File "c:\Python27\Lib\multiprocessing\process.py", line 286, in > File "c:\Python27\Lib\multiprocessing\process.py", line 283, in __init__ > TypeError: expected IList[Byte], got str > - > 2011/3/23 Oleksii Bidiuk >> >> Hi Romain, >> AFAIK you have to download the Python standard library separately. See >> e.g. http://www.ironpython.info/index.php/Using_the_Python_Standard_Library for >> examples (I've done it a while ago, so had to Google around a bit). >> >> 2011/3/23 Romain Gilles >>> >>> Hi all, >>> I'm trying to use this feature in ironpython. I just follow the first >>> sample: >>> >>> from multiprocessing import Process >>> def f(name): >>> print 'hello', name >>> if __name__ == '__main__': >>> p = Process(target=f, args=('bob',)) >>> p.start() >>> p.join() >>> >>> But I get the following error when I'm executing it: >>> >>> c:\temp>ipy test-ipy-multiprocessing.py >>> Traceback (most recent call last): >>> File "test-ipy-multiprocessing.py", line 1, in >>> ImportError: No module named multiprocessing >>> >>> Thanks for any help. >>> Regards. >>> Romain. >>> PS: I have just installed the last release of IronPython 2.7 >>> >>> c:\temp>ipy -V >>> PythonContext 2.7.0.40 on .NET 4.0.30319.1 >>> >>> ___ >>> Users mailing list >>> Users@lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >> >> >> >> -- >> oleksii > > > ___ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- -- Davy's Blog - http://daftspaniel.wordpress.com ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] multiprocessing in 2.7
Hi, First of all thanks for your answer :). But after updated my *IRONPYTHONPATH * as follow: set IRONPYTHONPATH=c:\Python27\Lib I get this error: - c:\temp>ipy test-ipy-multiprocessing.py Traceback (most recent call last): File "test-ipy-multiprocessing.py", line 1, in File "c:\Python27\Lib\multiprocessing\__init__.py", line 63, in File "c:\Python27\Lib\multiprocessing\process.py", line 286, in File "c:\Python27\Lib\multiprocessing\process.py", line 283, in __init__ TypeError: expected IList[Byte], got str - 2011/3/23 Oleksii Bidiuk > Hi Romain, > > AFAIK you have to download the Python standard library separately. See > e.g. > http://www.ironpython.info/index.php/Using_the_Python_Standard_Library for > examples (I've done it a while ago, so had to Google around a bit). > > 2011/3/23 Romain Gilles > >> Hi all, >> I'm trying to use this feature in ironpython. I just follow the first >> sample: >> >> from multiprocessing import Process >> >> def f(name): >> print 'hello', name >> >> if __name__ == '__main__': >> p = Process(target=f, args=('bob',)) >> p.start() >> p.join() >> >> But I get the following error when I'm executing it: >> >> c:\temp>ipy test-ipy-multiprocessing.py >> Traceback (most recent call last): >> File "test-ipy-multiprocessing.py", line 1, in >> ImportError: No module named multiprocessing >> >> >> Thanks for any help. >> >> Regards. >> >> Romain. >> >> PS: I have just installed the last release of IronPython 2.7 >> >> c:\temp>ipy -V >> PythonContext 2.7.0.40 on .NET 4.0.30319.1 >> >> >> ___ >> Users mailing list >> Users@lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > oleksii > ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] multiprocessing in 2.7
Hi Romain, AFAIK you have to download the Python standard library separately. See e.g. http://www.ironpython.info/index.php/Using_the_Python_Standard_Library for examples (I've done it a while ago, so had to Google around a bit). 2011/3/23 Romain Gilles > Hi all, > I'm trying to use this feature in ironpython. I just follow the first > sample: > > from multiprocessing import Process > > def f(name): > print 'hello', name > > if __name__ == '__main__': > p = Process(target=f, args=('bob',)) > p.start() > p.join() > > But I get the following error when I'm executing it: > > c:\temp>ipy test-ipy-multiprocessing.py > Traceback (most recent call last): > File "test-ipy-multiprocessing.py", line 1, in > ImportError: No module named multiprocessing > > > Thanks for any help. > > Regards. > > Romain. > > PS: I have just installed the last release of IronPython 2.7 > > c:\temp>ipy -V > PythonContext 2.7.0.40 on .NET 4.0.30319.1 > > > ___ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- oleksii ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com