deamon.py: 'module' object has no attribute 'fork'

Asked by alphaomega

Hello,

in "deamon.py" (by the way: this should be spelled "daemon", not "deamon" in the whole package ;-) I have a problem when I try to run the whole package under Windows XP (even after a lot of adjustments for Windows):

C:\heatpumpMonitor>python heatpumpMonitor.py start
Traceback (most recent call last):
  File "heatpumpMonitor.py", line 130, in <module>
    main()
  File "heatpumpMonitor.py", line 126, in main
    deamon.startstop(config.getLogFile(), config.getPidFile())
  File "C:\heatpumpMonitor\deamon.py", line 109, in startstop
    deamonize(stdout,stderr,stdin,pidfile,startmsg)
  File "C:\heatpumpMonitor\deamon.py", line 38, in deamonize
    pid = os.fork()
AttributeError: 'module' object has no attribute 'fork'

In "deamon.py" I had modified in line 24 from '/dev/null' (for Linux) to '>null' (for Windows) like this:

def deamonize(stdout='>null', stderr=None, stdin='>null', pidfile=None, startmsg = 'started with pid %s' ):

In addition I adjusted all paths, i.e. away from Linux like things like /etc/, or /var/ to the subdirectories I have under "heatpumpMonitor".

If someone has an idea how (if at all I could use the daemonized stuff under Windows, please let me know.
Or maybe I could (after which adjustments?) let the scripts run in foreground (instead of daemonized)?
I assume that under Windows the whole concept of daemons, pids etc. does not work at all, but I have no clue how I would need to adjust the python scripts of this package.

Thanks for any help - kind regards,
alphaomega

PS:
The basic script "protocol.py" now works, because I have now correctly chosen: serialDevice="\\.\COM5"
(instead of: "/dev/ttyS0" or "/dev/ttyUSB0")

Question information

Language:
English Edit question
Status:
Solved
For:
heatpumpMonitor Edit question
Assignee:
No assignee Edit question
Solved by:
Robert Penz
Solved:
Last query:
Last reply:
Revision history for this message
Steff (shb1999) said :
#1

Hi alphaomega,

in Windows OS there is no need for the deamon. You can simply comment it out in main() in heatpumpmonitor.py.
The script is running on my WinXP notebook since some weeks without problems so far. The only necessary change was to extend the timeslots when the render routine was called. 5 min were to short to render all graphs at my slow notebook....

Regards, Steff

Revision history for this message
Robert Penz (robert-penz-name) said :
#2

Steff, can you write a short howto how to get it running on windows on the new wiki site: http://heatpumpmonitor.penz.name/

ps: If there can be made changes in the code so it works on both I would be happy to apply them. e.g. a if clause which decides between linux and windows so some special parts.

Revision history for this message
Steff (shb1999) said :
#3

Hi Robert,

I can have a try. If you write the how-to for linux, I can add the necessary changes for Windows. :) There are just a few changes needed, mainly the name of the COM interface and the paths of the files.
And I had to change the graphsdefinition in the render module, because Windows seems to struggle with spaces within the titles or labels. I simply made underlines out of it...

Steff

Revision history for this message
alphaomega (alpha-omega) said :
#4

Hello Robert,
when trying to access your new wiki site (link above), I get an "500 - Internal Server Error".

Hello Steff,
thanks for the hint re. the daemon!

Best regards,
alphaomega

Revision history for this message
Robert Penz (robert-penz-name) said :
#5

your're right, just correct it.

Revision history for this message
Best Robert Penz (robert-penz-name) said :
#6

corrected

Revision history for this message
alphaomega (alpha-omega) said :
#7

Thanks Robert Penz, that solved my question.