Porting CCP4 python code to windows
Return to my Home Page.
About this document
This is just a collection of notes I have made from my experiences of porting
work on Windows. It only applies to Windows XP, however, some of the findings may also
apply to other Windows OS's. It's far from being a definitive guide but if it helps
somebody to avoid the pain and suffering I have had to deal with then it is of some
Notes - in no particular order
- Enviornment setup: To set any environment settings you will need go to Control Panel,
click on System, select the Advanced tab and then select Environment Variables.
Here you can add or edit enviornment variables.
- Getting your python script to work with CCP4i: Assuming you have created and installed the necessary
task files for your application you will then want it to run your script. To do this you need to preceed
your script name with python in the .script file of ccp4i. Below is an example of how to write the script
CreateComScript foo foo_script
set foo_py [file join $env(CCP4) bin/foo.py]
set cmd "[BinPath python] $foo_py HKLIN $HKLIN SEQIN $SEQIN HKLOUT $HKLOUT XYZOUT $XYZOUT"
set status [Execute $cmd $foo_script program_status report]
- Note that under Windows, the mtzdmp wrapper to "mtzdump" does not exist.
- CCP4 programs with an "_" in the name under unix will have a "-" in Windows. It is worth noting this when
calling CCP4 programs from within a python script.
- Watch out for environment variables that don't exist under Windows. The home directory of a user under XP
is referenced by the environment variable "USERPROFILE".
- Make sure that the python.exe is in the windows environment path.
- When calling the CCP4 executables from a python script make sure that you append .exe to end of the program
name. I found, with molrep in particular, windows will pick up .bat executables before .exe ones and this
can cause problems.