-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_modules_unix.py
More file actions
34 lines (30 loc) · 1.22 KB
/
my_modules_unix.py
File metadata and controls
34 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'''
Function:
Appends my_modules directory path onto the module search path variable.
UNIX Nitty Gritty Details:
Save the file in a location which is along the search python search path.
OR MUST add the location of this saved file to your python path variable
--- Extra path information ---
(PYTHONPATH - a list of directory names, with the same syntax as the
shell variable PATH).
Search: 1.2. Environment Variables
https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH
The format is the same as the shell’s PATH: append directory pathnames
separated colons on Unix.
An exampe for a bash instance terminal appended to the .bashrc file
on your unix/linus system is:
% export PYTHONPATH="$HOME/bin:$PYTHONPATH"
---------------------------------
USE:
Then by adding the below line to the top of a script, all modules in the
my_modules directory become accessible.
import add_my_unix_modules
References:
1. http://stackoverflow.com/questions/20843088/where-to-save-my-custom-scripts-
so-that-my-python-scripts-can-access-the-module
2. https://docs.python.org/2/tutorial/modules.html#the-module-search-path
'''
import sys
# sys.path.append( "/home/tboland1/")
# path/to/github/code/module/path" )
sys.path.append( "/path/to/files/" )