Return to Snippet

Revision: 10834
at January 15, 2009 13:55 by chombee


Updated Code
import sys
sys.path.append('./markdown-1.7')
from markdown import Markdown

Revision: 10833
at January 15, 2009 13:50 by chombee


Initial Code
sys.path.append('./markdown-1.7')
from markdown import Markdown

Initial URL

                                

Initial Description
When you want to import a python file but that file is not in the same directory as the python file you're importing _from_ (e.g. it's in a subdir). You need to add the directory that contains the file you want to import to your path environment variable `sys.path`. `sys.path` contains all the places python will look for a file when you do an import.

Initial Title
Import a file from a directory

Initial Tags

                                

Initial Language
Python