writing_python_scripts/quickref.tex
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 10 Nov 2010 10:24:03 +0530
changeset 435 975677bf1b8a
parent 335 d5248a15274c
permissions -rw-r--r--
Changes to progress.org.
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