|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
sys.path problem
I'm writing a python script which needs to read a package from a directory currently not known by python. I've simply appended the path to the sys module, then called the module in question, but on running, the package fails to be found. Here's the code I'm using:
#!/usr/bin/python import sys sys.path.append('/home/csunix/extras') import nltk #package located in above appended directory Any ideas where I'm going wrong??? |
|
#2
|
||||
|
||||
|
Permissions could be the problem.
When you say package do you mean module as in nltk.py or that nltk is a sub-directory of /home/csunix/extras conforming to the Python package format (it has a __init__.py file). grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
|
#3
|
|||
|
|||
|
Sorted. I did not reference the correct sub-directory containing the _init_.py
Thanks |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > sys.path problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|