[Twisted-Python] Could not create and run a Windows Service with Twisted 2.0.1 & Python 2.4.1
I've written a Twisted Windows Service which works perfectly with Twisted 1.3 and Python 2.3. I've used the sandboxed ntsvc from moonfallen's svn. I upgraded everything to Twisted 2.0.1 and Python 2.4.1 (even tried ActiveState's), and followed the information provided in moonfallen's README-service (that is, patch pywin32's boot_service.py). It compiles correctly to a .exe, without any supplementary error and I can install it correctly as a service (using 'xxxxxx.exe -install'). But When I try to launch it (in the GUI Service), it dies immediately, putting the following message in the Windows Event Observer: The instance's SvcRun() method failed File "win32serviceutil.pyc", line 742, in SvcRun File "ntsvc\runner.pyc", line 79, in SvcDoRun File "ntsvc\runner.pyc", line 48, in run File "twisted\application\app.pyc", line 31, in installReactor File "twisted\python\reflect.pyc", line 344, in namedModule exceptions.ImportError: No module named default I even cleaned my code to have just a .tac with 2 lines, and it does the same error. So I'm pretty sure it's not a problem in my code. Has anyone managed to create and run a service with Python 2.4.1 & Twisted 2.0.1? I'm using py2exe 0.5.4 and pywin32 204 both for python 2.4. Thanks, Luc -- Luc Stepniewski <luc.stepniewski@adelux.fr> Adelux - Securite, Linux Public key: <http://lstep.free.fr/pubkey.txt> Key BC0E3C2A fingerprint = A4FA466C68D27E46B427 07D083ED6340BC0E3C2A
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Luc, it's very common to get these near code that uses namedAny or named* from reflect. Using these calls guarantees that py2exe's module finding algorithm won't know to bundle the named module. You just need an "includes" line in your setup for twisted.internet.default. C Luc Stepniewski wrote: | I've written a Twisted Windows Service which works perfectly with Twisted 1.3 | and Python 2.3. I've used the sandboxed ntsvc from moonfallen's svn. | | I upgraded everything to Twisted 2.0.1 and Python 2.4.1 (even tried | ActiveState's), and followed the information provided in moonfallen's | README-service (that is, patch pywin32's boot_service.py). | | It compiles correctly to a .exe, without any supplementary error and I can | install it correctly as a service (using 'xxxxxx.exe -install'). But When I | try to launch it (in the GUI Service), it dies immediately, putting the | following message in the Windows Event Observer: | | The instance's SvcRun() method failed | File "win32serviceutil.pyc", line 742, in SvcRun | File "ntsvc\runner.pyc", line 79, in SvcDoRun | File "ntsvc\runner.pyc", line 48, in run | File "twisted\application\app.pyc", line 31, in installReactor | File "twisted\python\reflect.pyc", line 344, in namedModule | exceptions.ImportError: No module named default | | I even cleaned my code to have just a .tac with 2 lines, and it does the same | error. So I'm pretty sure it's not a problem in my code. | | Has anyone managed to create and run a service with Python 2.4.1 & Twisted | 2.0.1? I'm using py2exe 0.5.4 and pywin32 204 both for python 2.4. | | Thanks, | Luc | | | ------------------------------------------------------------------------ | | _______________________________________________ | Twisted-Python mailing list | Twisted-Python@twistedmatrix.com | http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCzpNY3A5SrXAiHQcRAqOpAKCGCIxf7rKe0m8Nz9uBjZ5DNzZHZQCfdFd8 lE+0kILxAevmGi2k5FBu/ms= =drPM -----END PGP SIGNATURE-----
On Friday 08 July 2005 16:53, Cory Dodt wrote:
Luc, it's very common to get these near code that uses namedAny or named* from reflect. Using these calls guarantees that py2exe's module finding algorithm won't know to bundle the named module.
You just need an "includes" line in your setup for twisted.internet.default.
Wow, you're right! It works. It's strange I didn't need this "includes" with Twisted 1.3. Anyway. I'll add this to the HOWTO, as soon as I can. Thanks, Luc -- Luc Stepniewski <luc.stepniewski@adelux.fr> Adelux - Securite, Linux Public key: <http://lstep.free.fr/pubkey.txt> Key BC0E3C2A fingerprint = A4FA466C68D27E46B427 07D083ED6340BC0E3C2A
On Fri, 8 Jul 2005 18:59:36 +0200, Luc Stepniewski <luc.stepniewski@adelux.fr> wrote:
On Friday 08 July 2005 16:53, Cory Dodt wrote:
Luc, it's very common to get these near code that uses namedAny or named* from reflect. Using these calls guarantees that py2exe's module finding algorithm won't know to bundle the named module.
You just need an "includes" line in your setup for twisted.internet.default.
Wow, you're right! It works. It's strange I didn't need this "includes" with Twisted 1.3. Anyway. I'll add this to the HOWTO, as soon as I can.
twisted.internet.default was never really public anyway, and now it's deprecated. The ideal solution would be to stop using it altogether. What's it being imported for? Jp
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It's not being imported by user code, it's being imported by t.service.app. Py2exe doesn't know that, so it loses it. Luc, probably ntsvc should deal with this automatically. Let me think about it before you put it in the HOWTO. C Jp Calderone wrote: | On Fri, 8 Jul 2005 18:59:36 +0200, Luc Stepniewski | <luc.stepniewski@adelux.fr> wrote: | |> On Friday 08 July 2005 16:53, Cory Dodt wrote: |> |>> Luc, it's very common to get these near code that uses namedAny or |>> named* |>> from reflect. Using these calls guarantees that py2exe's module finding |>> algorithm won't know to bundle the named module. |>> |>> You just need an "includes" line in your setup for |>> twisted.internet.default. |> |> |> Wow, you're right! It works. It's strange I didn't need this |> "includes" with |> Twisted 1.3. Anyway. I'll add this to the HOWTO, as soon as I can. | | | twisted.internet.default was never really public anyway, and now it's | deprecated. The ideal solution would be to stop using it altogether. | What's it being imported for? | | Jp | | _______________________________________________ | Twisted-Python mailing list | Twisted-Python@twistedmatrix.com | http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCzr0/3A5SrXAiHQcRAop4AKCdAcMcQpEvFTrZbtsXIkoQoVQ5YwCePO+n OSxJhzReqZbBDrOmSCynFDw= =yRFv -----END PGP SIGNATURE-----
participants (3)
-
Cory Dodt
-
Jp Calderone
-
Luc Stepniewski