temporary files remain when python raises exception

Bug #1083973 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 28.11.2012 00:59, schrieb Mat:> Just a remark for potential readers, you need to set :
>
> (setq py-jump-on-exception nil)
>
> in your .emacs to get no temporary files in case a python exception is
> raised following a 'C-c C-c'
>
> Thanks again Andreas.
>
> Mat
>

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

seems to affect python-mode-v5-bavior only

not files are left, just the temp buffer

Changed in python-mode:
importance: Medium → Low
milestone: 6.1.0 → 6.1.1
Revision history for this message
Mat (mattlke) wrote :

Hello Andreas,

it now works well when the exception is raised in the current python file !

But I just happened to have an exception in a package file.

For example if I execute the following code :

import urllib

f = urllib.urlopen('blabla.html')

Then the error is raised in urllib, and I have the temporary buffer/file that instantly replaces my python file.

Could you please have a look ?

Thanks !

Matthieu

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

Hmm, can't get it. Test buffer kept - see attachment. Also tmp dir and temp-file cleaned up.

Revision history for this message
Mat (mattlke) wrote :

Hello Andreas,

here is my screen capture.
Did you activate the v5 mode ?
I set "t" to both the variable and the v5 function.

Thanks very much for your help.

Mat

Changed in python-mode:
importance: Low → Medium
Revision history for this message
Andreas Roehler (a-roehler) wrote :

As first line containing "import" indicates, it's executed in directory $HOME, where "blabla.html" isn't found.

Indicating a complete path for urlopen('... should solve it.

Alternatively customizing `use-current-dir-when-execute-p' to `t'

See also in PyTools -> Modes

Revision history for this message
Mat (mattlke) wrote :

Hello Andreas,

here is another screen copy showing my problem.

As you can see, a temporary file is created, and that does not happen when the exception is raised in the current python file.

Thanks in advance if you can have a look at it.

Mat

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

obviously your file is not found in $HOME
it must reside elsewhere

either specify the path with urlopen('PATH...
or set `py-execute-buffer' accordingly

also in script writing

os.chdir("MY_DIR")

should work.

Finally, if already in right, current directory,

py-use-current-dir-when-execute-p

should suffice when set to `t'

attached an example as it works here

Revision history for this message
Mat (mattlke) wrote :

Hello Andreas,

thanks for answering so fast.
The last thing I would want is to make you lose patience on this.
But I have to confess that I'm kind of lost here.

No "blabla.html" is neither in my /home nor in my current directory, indeed.
But this I had made it on purpose. To show you that a "temporary file" buffer is created in this case.

In the screen_copy_2.png I had made a circle to show you the "temporary file" buffer.

Here is another screen copy to show you the difference, between the exception being raised in the
current python file (python-mode.el works well :) ), and the exception being raised in urllib (doesn't work :( ).

To make this test, I took the latest revision of python-mode.el (1161), and all I have in my .emacs (relating to python-mode) is :

-------------
(setq python-mode-v5-behavior-p t)
(setq py-jump-on-exception nil)

(custom-set-variables
 '(python-mode-v5-behavior t)
)
-------------

Thanks !

Mat

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1083973] Re: temporary files remain when python raises exception

Am 10.12.2012 08:55, schrieb Mat:
> Hello Andreas,
>
> thanks for answering so fast.
> The last thing I would want is to make you lose patience on this.

Far from that. Your info is very important, as any users info.
Even possibly mistakes reported are valuable, as developers might see,
where users run into.

> But I have to confess that I'm kind of lost here.

Proceeding isn't straightforward yet as it should be. Must reconsider that part and simplify.

>
> No "blabla.html" is neither in my /home nor in my current directory, indeed.
> But this I had made it on purpose. To show you that a "temporary file" buffer is created in this case.
>
> In the screen_copy_2.png I had made a circle to show you the "temporary
> file" buffer.
>
> Here is another screen copy to show you the difference, between the exception being raised in the
> current python file (python-mode.el works well :) ), and the exception being raised in urllib (doesn't work :( ).
>
> To make this test, I took the latest revision of python-mode.el (1161),
> and all I have in my .emacs (relating to python-mode) is :
>
> -------------
> (setq python-mode-v5-behavior-p t)
> (setq py-jump-on-exception nil)
>
> (custom-set-variables
> '(python-mode-v5-behavior t)
> )
> -------------

okay, so I'm on it,

Cheers,

Andreas

Revision history for this message
Mat (mattlke) wrote :

Cool :)
Your help is really appreciated :)

Thanks

Mat

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

Checked in some changes, please try again.

Revision history for this message
Mat (mattlke) wrote :

Hello Andreas,

thanks again for answering very fast.
I 've tried this new version, I have nothing else to say that now it works perfectly.
I've also noticed that the "python shell" buffer disappeared, which is cool :)

I took a look at the diff, I saw that there was quite a bunch of new code.
I really appreciate the time you spent on this.
I hope you won't decide one day to stop maintaining this "v5-mode" :P

I hope I won't come back here too soon :D

Cheers !

Mat

Changed in python-mode:
status: New → 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.