SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    fakemail in python not working on windows (os.fork)

    hi guys,

    having failed to install the perl version of fakemail (http://www.sitepoint.com/forums/showthread.php?t=611257 - thanks anyway Kevin!) I downloaded the python version and it works fine if I manually invoke it from the command line or a .bat file.

    I cannot however get the following test case to run: http://www.lastcraft.com/fakemail.php

    The problem (seems to be) with the --background parameter sent to the script:

    Code Python:
    fakemail.py --host=localhost --port=10025 --path=. --background

    Because if I run that from the command line, it shows the error: AttributeError: object has no attribute 'fork'

    A quick Google search shows that python on Windows does not use os.fork() (among other os functions it seems).

    If I use fakemail without the background parameter then the manual scripts work, but the test case just hangs (since I presume PHP is waiting for fakemail to terminate before running the rest of the script).

    I'm stuck!! Any help appreciated, I've been wrestling with this for a few days now..

  2. #2
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem code is here apparently:
    Code Python:
    def become_daemon():
        # See "Python Standard Library", pg. 29, O'Reilly, for more
        # info on the following.
        pid = os.fork()
        if pid:  # we're the parent if pid is set
            os._exit(0)
        os.setpgrp()
        os.umask(0)

    According to http://effbot.org/librarybook/os.htm
    I can use spawnv to replicate this process but I don't know python at all so I'm not sure how.

    Any help or suggestions to run fakemail.py alternatively would be much appreciated!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •