Generate XDS.INP: Difference between revisions

Jump to navigation Jump to search
Calling generate_XDS.INP from a Python script
(Calling generate_XDS.INP from a Python script)
Line 497: Line 497:


If you do use cut-and-paste from the webpage, be aware of the following problem report: On the Mac, after loading frames, by clicking “generate XDS.INP”, the program gives some strange symbol “” in XDS.INP. And the more you click “save” button, the more “” appear. This looks like e.g. <br>SPACE_GROUP_NUMBER=0  ! 0 if unknown <br>UNIT_CELL_CONSTANTS= 70 80 90 90 90 90  <br> ''The problem is due to the “Rich text” format in TextEdit when saving "generate_XDS.INP". It is solved by re-downloading the script, and changing format to Plain - everything should work then.''
If you do use cut-and-paste from the webpage, be aware of the following problem report: On the Mac, after loading frames, by clicking “generate XDS.INP”, the program gives some strange symbol “” in XDS.INP. And the more you click “save” button, the more “” appear. This looks like e.g. <br>SPACE_GROUP_NUMBER=0  ! 0 if unknown <br>UNIT_CELL_CONSTANTS= 70 80 90 90 90 90  <br> ''The problem is due to the “Rich text” format in TextEdit when saving "generate_XDS.INP". It is solved by re-downloading the script, and changing format to Plain - everything should work then.''
== Calling generate_XDS.INP from a Python script ==
It is recommended to use the [http://docs.python.org/2/library/subprocess.html subprocess.Popen()] module instead of [http://docs.python.org/2/library/os.html os.system()]:
<pre>
subprocess.Popen(["generate_XDS.INP",imagepath],stdout=outputfile)
</pre>
where imagepath is a string containing the path to an image and outputfile is either a chosen variable for an output file or subprocess.PIPE if you're not interested in the output of the script.
The module os.system() internally uses /bin/sh to execute the command and overrides #!/bin/bash at the beginning of the script. While this is not a problem on most operating systems, /bin/sh points to dash instead of bash on Ubuntu, which leads to a program crash with the error message
<pre>
sh: 1: Syntax error: Bad fd number
</pre>
7

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu