#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    40
    Rep Power
    10

    Question py2exe cant work in services?


    hello!

    i was wrote some script in python (hello.py)
    then, i was convert it into .exe file with py2exe (hello.exe)
    then, i try to call the .exe inside a window service code with
    os.system("hello.exe")
    but i found that it doesnt work when i execute the service!

    my question is what are the reasons that cause the "call exe" cant work?

    i'm using py2.3 + winXP Pro

    thanks for advice...
    ah new
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    From your cross post it looks like your service has failed to import the os module. Have you looked at the import os statement in your code.

    My reference book suggests that services should only communicate using Windows NT Event log or via simple dialogs.

    I'm guessing here but I don't think services will have stdout or stdin which means that printing and input will fail - any print statments before your import os command could cause you problems. This might also apply to sub-processes.

    grim
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    40
    Rep Power
    10
    the "import os" is the 1st line in my program ("hello.py")
    the problem is seems all imported cant be load when i convert the file to .exe ("hello.exe")
    any other ideas?

    ah new...
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Location
    Cape Town, South Africa
    Posts
    131
    Rep Power
    12

    Pasting the code would help.


    It sounds like you're dealing with relatively simple programs. Why not just paste the code here, I'm betting there's a tiny bug somewhere waiting to be squished.

    Cheers,
    K

    ps: don't forget to format the code properly in your post.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    40
    Rep Power
    10
    yeah!
    the problem been solve after i add the library zip file inside the dist folder to the sys path.
    but another problem was come to surface...
    the traceback...
    File "xml\sax\sax2exts.pyc", line 37, in make_parser
    File "xml\sax\saxexts.pyc", line 77, in make_parser
    xml.sax._exceptions.SAXReaderNotAvailable: No parsers found
    ....
    any ideas about it?
    ps: i was installed PyXML..

    thanks for advices ;-)

    ah new ...
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Location
    Cape Town, South Africa
    Posts
    131
    Rep Power
    12
    Howdy

    I have no personal experience in the matter but I bet this will help:

    http://www.oreillynet.com/cs/user/view/cs_msg/22143

    Good luck,
    K

IMN logo majestic logo threadwatch logo seochat tools logo