This is a read-only mirror of pymolwiki.org

Difference between revisions of "Fork"

From PyMOL Wiki
Jump to navigation Jump to search
 
m (8 revisions)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===DESCRIPTION===
+
'''spawn''' launches a Python script in a new thread which will run concurrently with the PyMOL interpreter. It can be run in its own namespace (like a Python module, default), a local name space, or in the global namespace.
+
 
  "spawn" launches a Python script in a new thread which will run
+
'''fork''' is an alias for '''spawn'''.
  concurrently with the PyMOL interpreter. It can be run in its own
+
 
  namespace (like a Python module, default), a local name space, or
 
  in the global namespace.
 
 
 
===USAGE===
 
===USAGE===
    run python-script [, ( local | global | module | main | private )]
+
spawn python-script [, ( local | global | module | main | private )]
+
 
 
===PYMOL API===
 
===PYMOL API===
    Not directly available.  Instead, use cmd.do("spawn ...").
+
Not directly available.  Instead, use cmd.do("spawn ...").
 
   
 
   
 
===NOTES===
 
===NOTES===
    The default mode for spawn is "module".
+
The default mode for spawn is "module".
 
   
 
   
  Due to an idiosyncracy in Pickle, you can not pickle objects
+
Due to an idiosyncracy in Pickle, you can not pickle objects directly created at the main level in a script run as "module", (because the pickled object becomes dependent on that module). Workaround: delegate construction to an imported module.
  directly created at the main level in a script run as "module",
 
  (because the pickled object becomes dependent on that module).
 
  Workaround: delegate construction to an imported module.
 
 
   
 
   
  The best way to spawn processes at startup is to use the -l option
+
The best way to spawn processes at startup is to use the -l option (see "help launching").  
  (see "help launching").  
+
 
 +
=== SEE ALSO ===
 +
 
 +
* [[run]]
  
[[Category:Commands|fork]] [[Category:Commands|spawn]]
+
[[Category:Commands|Fork]]

Latest revision as of 01:46, 28 March 2014

spawn launches a Python script in a new thread which will run concurrently with the PyMOL interpreter. It can be run in its own namespace (like a Python module, default), a local name space, or in the global namespace.

fork is an alias for spawn.

USAGE

spawn python-script [, ( local | global | module | main | private )]

PYMOL API

Not directly available. Instead, use cmd.do("spawn ...").

NOTES

The default mode for spawn is "module".

Due to an idiosyncracy in Pickle, you can not pickle objects directly created at the main level in a script run as "module", (because the pickled object becomes dependent on that module). Workaround: delegate construction to an imported module.

The best way to spawn processes at startup is to use the -l option (see "help launching").

SEE ALSO