shell wrong path

Bug #884739 reported by Andreas Roehler
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

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)))
>

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
milestone: none → 6.0.4
importance: Undecided → Medium
Changed in python-mode:
status: New → Opinion
Changed in python-mode:
status: Opinion → New
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Am 01.11.2011 22:50, schrieb Andrea Crotti:
[ ... ]
> > And anyway, I think is quite a bug, because if I run a python script I
> > should expect that it runs in the same current directory...
I quite agree.

Georg

Revision history for this message
Andreas Roehler (a-roehler) wrote :

better now?

Changed in python-mode:
status: New → In Progress
Revision history for this message
Andrea Crotti (andrea-crotti-0) wrote :

I did a bzr pull, deleted the "elc", reloaded python-mode,
then I created a simple file

import os
print("hello from %s" % os.getcwd())

and run it, I still see the CWD from the previously running python, not
the CWD of the current script..

Revision history for this message
Andreas Roehler (a-roehler) wrote :

whats the precise command you used as "run"

M-x py-execute-buffer here yields in buffer

*Python*

>>> ## executing temporary file /tmp/Python3442A4R.py...
hello from MY-USERDIR

;;;;;;;

C-h v default-directory
-->
default-directory is a variable defined in `C source code'.
Its value is
"PATH-WHERE-SKRIPT-RESIDES/"

;;;;;;;;;;;

i.e. getcwd()

returns $HOME

Revision history for this message
Andreas Roehler (a-roehler) wrote :

could you try again?

Revision history for this message
Andrea Crotti (andrea-crotti-0) wrote :

Now it seems to work :)
I tried two different scripts running on the same *Python* and they run in the right CWD...

Thanks

Changed in python-mode:
status: In Progress → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.