problems with compiling and finding modules

Miki Tebeka tebeka at cs.bgu.ac.il
Mon Apr 28 12:17:16 CEST 2003


Hello Steven,

> I use a programmer's editor called "Visual SlickEdit".  I'm trying to set 
> it up to work with Python.  So, how do I get it to compile a python file.  
> I can't seem to find a command line method for either compiling a .py file 
> to a .pyc file or even just do a syntax check for finding errors in the 
> editor.  I found a file called py_compile, but this just seems to add a 
> function called compile which I can execute from the interpreter but not 
> the command line.  The file compileall, will compile everything in 
> directory or entire tree, but not just a single file.  I would asume there 
> must be a way short of writing my own single file compile script.  I 
> understand I'm going to have to do something like:
> 
>   python compile_command myfile.py
> 
> but what do I put in for compile_command?
Have a look at: http://mail.python.org/pipermail/python-list/2002-June/107625.html
It's for VIm but you should get the general idea.

> Also, how do I change the working directory from within IDLE?  If I open my 
> .py file from the Windows Explorer using a right click and choose 'Edit 
> with IDLE', everything works fine, but if I 'Open...' a .py file from 
> within IDLE, it can't find modules I import from.  I assume this is because 
> it isn't in the current directory.
Python find modules according to what's in sys.path so:
import sys
sys.path.append('my/python/dir')
should do the trick.

HTH.
Miki




More information about the Python-list mailing list