writing_python_scripts/quickref.tex
author bhanu
Mon, 15 Nov 2010 14:40:49 +0530
changeset 499 fff4a90b2310
parent 335 d5248a15274c
permissions -rw-r--r--
Language check done for `least square fit`
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