[Python-mode] py-execute-buffer and CWD

Andreas Röhler andreas.roehler at online.de
Tue Nov 1 21:53:30 CET 2011


Am 01.11.2011 12:33, schrieb Andrea Crotti:
> While trying to run a script and there is already another *Python*
> buffer open
> for another directory, running the script normally fails if there are some
> relative file paths.
>
> Apparently the CWD in the *Python* buffer remains the old one, and thus it
> makes sense that Python can't resolve relative paths.
>
> I tried to add this line in py-execute-buffer but without success,
> any help?
>
> (cd (file-name-directory (buffer-file-name py-master-file)))

cd is a shell command

you can't mix that into Emacs Lisp.

BTW ipython shell would understand "cd" it, but that's another item.

Maybe give a example, what you trying to do, so we can look how to solve 
that task.

BTW answered here, as you are not indicating a bug as thought at first 
glance. My mistake...



More information about the Python-mode mailing list