importing common files

35 views
Skip to first unread message

tvn

unread,
Nov 9, 2012, 11:27:20 PM11/9/12
to sage-s...@googlegroups.com
I'd like to import some utility files in a separate directory to my project, e.g. that I can do "import util" from the Sage prompt.  Adding tat directory to the SAGE_PATH variable allows me to do so,   however doing that will cause problem when I want to read the document of any function in SAGE.  For example, 

sage: solve??   
ImportError                               Traceback (most recent call last)

....

ImportError: No module named conf

Any idea how to properly import files from a different directory ?  

P Purkayastha

unread,
Nov 10, 2012, 1:10:02 AM11/10/12
to sage-s...@googlegroups.com
If all your files are only in one directory you can do this.

import os
os.chdir('/path/to/utility/directory')
import util


Reply all
Reply to author
Forward
0 new messages