Hello there,

I have a problem moving files from my local harddrive to a NFS share using a Python script. The script is used to run a model which produces large (~500MB) binary output files. The model itself is a Fortran program, and I call it from my script using the line

os.spawnlp(os.P_WAIT, 'time', 'time', OPT.binary)

where OPT.binary is the filename to be run. This works flawlessly.

However, in order not to clutter up my harddrive, I want to move the generated files to a network location after each model run. To save time, I use os.P_NOWAIT here:

os.spawnlp(os.P_NOWAIT, 'mv', 'mv', LOCALFILENAME, REMOTEFILENAME)

where LOCALFILENAME is some string like '/home/andreas/model.bin' and REMOTEFILENAME is some string like '/home/nfs/model-output/'.

Here I have the problem that after about every 10th model run, I get an error saying

Traceback (most recent call last):
  File "../../../../pyiup/b3dctm/run_b3dctm.py", line 281, in <module>
    main()
  File "../../../../pyiup/b3dctm/run_b3dctm.py", line 71, in main
    copy_model_output()
File "../../../../pyiup/b3dctm/run_b3dctm.py", line 162, in copy_model_output os.spawnlp(os.P_NOWAIT, 'mv', 'mv', get_base_filename(RUNDATE) + '.pdg', os.path.join(OPT.datastoragepath,OPT.modelname,OPT.runname,RUNDATE.strftime('%Y/
%m')))
  File "/usr/lib64/python2.5/os.py", line 635, in spawnlp
    return spawnvp(mode, file, args)
  File "/usr/lib64/python2.5/os.py", line 584, in spawnvp
    return _spawnvef(mode, file, args, None, execvp)
  File "/usr/lib64/python2.5/os.py", line 530, in _spawnvef
    pid = fork()
OSError: [Errno 12] Cannot allocate memory

And my Python script dies.

Is there anyone who can help me with this problem? I'm on Ubuntu 8.04 64bit with Python 2.5. I am willing to accept that the moving of the files does not always work, but then it would be really helpful if I could somehow prevent my script from dying and just try the moving again.

Any help is greatly appreciated!

Cheers,

Andreas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to