I changed the code to this:
import multiprocessing.forking
import os
class _Popen(multiprocessing.forking.Popen):
def __init__(self, *args, **kw):
os.putenv('_MEIPASS2',
os.path.dirname(os.path.abspath(__file__)) + ' ')
try:
super(_Popen, self).__init__(*args, **kw)
finally:
os.unsetenv('_MEIPASS2')
class Process(multiprocessing.Process):
pass
Process._Popen = _Popen
class SendeventProcess(Process):
def __init__(self, resultQueue):
self.resultQueue = resultQueue
multiprocessing.Process.__init__(self)
self.start()
def run(self):
print 'SendeventProcess'
self.resultQueue.put((1, 2))
print 'SendeventProcess'
if __name__ == '__main__':
multiprocessing.freeze_support()
print 'pyb'
resultQueue = multiprocessing.Queue()
SendeventProcess(resultQueue)
print 'pyb'
I couldn't define Process this way:
class Process(multiprocessing.Process):
_Popen = _Popen
Doing so caused an error (from PyInstaller code, IIRC) about a key not
being in a dictionary ('_Popen' being the key, and the class the
dictionary?)
I don't know what value of _MEIPASS2 should be used. Notice that I
added a space at the end, because PyInstaller was truncating the value
by one.
I eventually ran my production code on Windows 7 and Windows XP using
r1609 with these changes incorporated. Windows 7 was fine. XP gave an
error
Traceback (most recent call last):
File "<string>", line 31, in <module>
File "C:\Users\b\p\tst\d\pyinstaller-trunk-r1609\trialInstaller\build
\pyi.win32\trialInstaller\outPYZ1.pyz\os", line 150, in makedirs
File "C:\Users\b\p\tst\d\pyinstaller-trunk-r1609\trialInstaller\build
\pyi.win32\trialInstaller\outPYZ1.pyz\os", line 157, in makedirs
WindowsError: [Error 5] Access is denied: 'C:\\Program Files\\support'
A second executable in the production code fell into an infinite loop.
I've never seen these two errors on Windows 7, but it's possible they
are my own errors. I don't have full-time access to the XP machine to
dig into the problems.
Brian
On Oct 8, 4:52 am, Hartmut Goebel <[email protected]> wrote:
> Am 08.10.2011 05:52, schrieb Brian:
>
> > Thanks, Hartmut. There are some errors in the solution you posted that
> > you'll be able to discover using your current platform before it's
> > necessary to test on Windows.
>
> Sure, but i was in a hurry ;-) I wanted to post the basic idea anyway.
>
> > there is no multiprocessing.forking.Popen class
>
> These is, see `pydoc multiprocessing.forking.Popen`, just the import was
> wrong. One needs to import multiprocessing.forking explicitly.
>
> You must not inherit from subprocess.Popen, which, is a different
> implementation. See multiprocessing.forking. This is why your code fails.
>
> I've just uploaded an new version which works (unpackaged) on Linux.
> Please try this.
>
> --
> Schönen Gruß - Regards
> Hartmut Goebel
> Dipl.-Informatiker (univ.), CISSP, CSSLP
>
> Goebel Consult
> Spezialist für IT-Sicherheit in komplexen
> Umgebungenhttp://www.goebel-consult.de
>
> Monatliche Kolumne:http://www.cissp-gefluester.de/
> Goebel Consult ist Mitglied beihttp://www.7-it.de
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.