writing_python_scripts/quickref.tex
author Anoop Jacob Thomas<anoop@fossee.in>
Tue, 26 Oct 2010 13:06:20 +0530
changeset 348 3f70aeb1e115
parent 335 d5248a15274c
permissions -rw-r--r--
reviewed accessing parts of array script.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
335
d5248a15274c Finished writing_python_scripts
Nishanth <nishanth@fossee.in>
parents: 296
diff changeset
     1
See where python searches for modules:\\
d5248a15274c Finished writing_python_scripts
Nishanth <nishanth@fossee.in>
parents: 296
diff changeset
     2
{\ex \lstinline|    sys.path|}
296
641a6ee868c0 made the script writing_python_scripts into new form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     3
335
d5248a15274c Finished writing_python_scripts
Nishanth <nishanth@fossee.in>
parents: 296
diff changeset
     4
Include our own path in PYTHONPATH:\\
d5248a15274c Finished writing_python_scripts
Nishanth <nishanth@fossee.in>
parents: 296
diff changeset
     5
{\ex \lstinline|    sys.path.append(our_path)|}
296
641a6ee868c0 made the script writing_python_scripts into new form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     6
335
d5248a15274c Finished writing_python_scripts
Nishanth <nishanth@fossee.in>
parents: 296
diff changeset
     7
Run certian code only if executed and not if imported:\\
d5248a15274c Finished writing_python_scripts
Nishanth <nishanth@fossee.in>
parents: 296
diff changeset
     8
{\ex \lstinline|    if __name__=="__main__": #do something|}
d5248a15274c Finished writing_python_scripts
Nishanth <nishanth@fossee.in>
parents: 296
diff changeset
     9