<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Scripting_FAQs</id>
	<title>Scripting FAQs - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Scripting_FAQs"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;action=history"/>
	<updated>2026-04-21T17:01:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8758&amp;oldid=prev</id>
		<title>Bell: 6 revisions</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8758&amp;oldid=prev"/>
		<updated>2014-03-28T03:09:16Z</updated>

		<summary type="html">&lt;p&gt;6 revisions&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 03:09, 28 March 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Bell</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8757&amp;oldid=prev</id>
		<title>Rlc: Fixed error in example for passing command line options to a script.</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8757&amp;oldid=prev"/>
		<updated>2014-01-15T16:42:45Z</updated>

		<summary type="html">&lt;p&gt;Fixed error in example for passing command line options to a script.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:42, 15 January 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l40&quot; &gt;Line 40:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 40:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;from sys import argv&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;from sys import argv&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;my_argv =&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;3D &lt;/del&gt;argv[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;argv.index(&amp;quot;--&amp;quot;)&lt;/del&gt;:]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;my_argv = argv[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;1&lt;/ins&gt;:]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print my_argv[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;1&lt;/del&gt;], my_argv[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2&lt;/del&gt;]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print my_argv[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;0&lt;/ins&gt;], my_argv[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;1&lt;/ins&gt;]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Scripting]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Scripting]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rlc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8756&amp;oldid=prev</id>
		<title>Cank: Scripting FAQa moved to Scripting FAQs</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8756&amp;oldid=prev"/>
		<updated>2009-03-11T18:31:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/index.php/Scripting_FAQa&quot; class=&quot;mw-redirect&quot; title=&quot;Scripting FAQa&quot;&gt;Scripting FAQa&lt;/a&gt; moved to &lt;a href=&quot;/index.php/Scripting_FAQs&quot; title=&quot;Scripting FAQs&quot;&gt;Scripting FAQs&lt;/a&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:31, 11 March 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Cank</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8755&amp;oldid=prev</id>
		<title>Cank: Scripting moved to Scripting FAQa</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Scripting_FAQs&amp;diff=8755&amp;oldid=prev"/>
		<updated>2009-03-11T18:31:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/index.php/Scripting&quot; class=&quot;mw-redirect&quot; title=&quot;Scripting&quot;&gt;Scripting&lt;/a&gt; moved to &lt;a href=&quot;/index.php/Scripting_FAQa&quot; class=&quot;mw-redirect&quot; title=&quot;Scripting FAQa&quot;&gt;Scripting FAQa&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Script within a Structure==&lt;br /&gt;
Q: Is there a way to embed a script within a PDB structure?&lt;br /&gt;
&lt;br /&gt;
A: Yes, there are two ways&lt;br /&gt;
* Use the [[Read_Pdbstr]] command like,&lt;br /&gt;
 delete all&lt;br /&gt;
 cmd.read_pdbstr(&amp;quot;&amp;quot;&amp;quot;HETATM 1985  O00 MOH   132      18.797   6.477 -12.112 0.00  0.00           O\&lt;br /&gt;
 HETATM 1988  H03 MOH   132      18.437   7.229 -11.665  0.00  0.00    H\&lt;br /&gt;
 HETATM 1989  C04 MOH   132      17.737   5.662 -12.563  0.00  0.00    C\&lt;br /&gt;
 HETATM 1990  H05 MOH   132      18.129   4.785 -13.080  0.00  0.00    H\&lt;br /&gt;
 HETATM 1991  H06 MOH   132      17.096   6.211 -13.253  0.00  0.00    H\&lt;br /&gt;
 HETATM 1992  H07 MOH   132      17.130   5.322 -11.722  0.00  0.00    H&amp;quot;&amp;quot;&amp;quot;,&amp;quot;mymolecule&amp;quot;)&lt;br /&gt;
 show sticks&lt;br /&gt;
&lt;br /&gt;
Don't forget the backslashes there -- it's one long command.&lt;br /&gt;
[http://chips.csb.ki.se/pymol/msg02104.html Example]&lt;br /&gt;
&lt;br /&gt;
* Or, as Warren noted, you can do with with a &amp;quot;p1m&amp;quot; file, which is like a &amp;quot;pml&amp;quot; file, but data can be included as well.  Also note that p1m files are intended for web publishing, so embedded Python is disallowed.  In p1m files, there is an &amp;quot;embed&amp;quot; command that enables this for PDB, MOL, MOL2, SDF, and XPLOR data.  It works like this:&lt;br /&gt;
 embed tag, format&lt;br /&gt;
 ****REPLACE THIS LINE WITH YOUR DATA FILE****&lt;br /&gt;
 embed end&lt;br /&gt;
&lt;br /&gt;
 load_embedded tag&lt;br /&gt;
where tag is some identifier of your choice.&lt;br /&gt;
&lt;br /&gt;
==Scripting and Command Line Options==&lt;br /&gt;
PyMol will allow you to use command line options in a script.  That means, the following&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
pymol -qrc script.py arg1 arg2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
will work if you add a double-hyphen before the first argument in order&lt;br /&gt;
to signal Pymol to stop interpreting arguments:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
pymol -qrc script.py -- arg1 arg2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then your script can get these arguments as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from sys import argv&lt;br /&gt;
my_argv =3D argv[argv.index(&amp;quot;--&amp;quot;):]&lt;br /&gt;
print my_argv[1], my_argv[2]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Cank</name></author>
	</entry>
</feed>