import sys, os
homelibdir = os.path.join(os.path.expanduser('~'), 'lib', 'python')
if homelibdir not in sys.path:
sys.path.append(homelibdir)
The path it ended up with was
/home/danielb/lib/python
I cant seem to find this directory. Where am I putting these files?
[...]
#!/usr/bin/python
import os
hlb = os.path.expanduser('~')
os.mkdir(hlb+'/lib')
os.mkdir(hlb+'/lib/python')
file(hlb+'/lib/python/FINDME.txt').close()
A few notes on the code:I still cant get it to work. >_<
[...]
tried using
Code:#!/usr/bin/python import os hlb = os.path.expanduser('~') os.mkdir(hlb+'/lib') os.mkdir(hlb+'/lib/python') file(hlb+'/lib/python/FINDME.txt').close()
I modified the script, and it has created the file. However, when I put the library there i still cant import it.
it made the file in ./lib/python
Using a file transfer app/file manager is better than Python for creating folders as it's easier to check ownership, permissions and even success.