.temp.py

1,289 views
Skip to first unread message

Rothrock

unread,
Jun 30, 2014, 11:24:50 PM6/30/14
to spyd...@googlegroups.com
Running spyder 2.2.5 on Mavericks. Every time I start Spyder I get a file .temp2.py open in the editor. It tells me 

# -*- coding: utf-8 -*-

"""

Spyder Editor


This temporary script file is located here:

/Users/rothrock/.spyder2/.temp.py

"""


I've gone in and renamed the file. If I close .temp.py before closing spyder and rename it using terminal then I get a new .temp.py generated when I open spyder. If I leave it open, quit spyder and then rename .temp.py I get an error the next time I open spyder:


Spyder 2.2.5 internal shell on Python 2.7.5 64bits [Darwin]

Inspect Spyder internals:

  spy.app, spy.window, dir(spy)

>>> Traceback (most recent call last):

  File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/plugins/editor.py", line 505, in restore_scrollbar_position

    self.get_current_editor().centerCursor()

AttributeError: 'NoneType' object has no attribute 'centerCursor'


How can I get rid of .temp.py and not have an error when I start up spyder?

Adrian Klaver

unread,
Jul 1, 2014, 9:18:04 AM7/1/14
to spyd...@googlegroups.com
On 06/30/2014 08:24 PM, Rothrock wrote:
> Running spyder 2.2.5 on Mavericks. Every time I start Spyder I get a
> file .temp2.py open in the editor. It tells me
>

>
> How can I get rid of .temp.py and not have an error when I start up spyder?
>

I just close the tab containing the file. It is just a placeholder file.


--
Adrian Klaver
adrian...@aklaver.com

Rothrock

unread,
Jul 1, 2014, 6:38:40 PM7/1/14
to spyd...@googlegroups.com
Thanks, but I really would like to get rid of it.

Is this standard? Does everybody get .temp.py at start up? Is it a "feature"?

Adrian Klaver

unread,
Jul 1, 2014, 10:29:36 PM7/1/14
to spyd...@googlegroups.com
On 07/01/2014 03:38 PM, Rothrock wrote:
> Thanks, but I really would like to get rid of it.

AFAIK there is no setting to disable. See below for more complete answer.

>
> Is this standard? Does everybody get .temp.py at start up? Is it a
> "feature"?
>

You get it if there are no other files open. I usually leave files in
the editor when I close so I see them when I open the editor again and I
do not get temp.py.


--
Adrian Klaver
adrian...@aklaver.com

Rothrock

unread,
Jul 4, 2014, 12:56:22 PM7/4/14
to spyd...@googlegroups.com
Thank you. That is a little less annoying.

By the way, I'm not getting temp.py I'm getting .temp.py. I would so prefer that if it had to open a blank document that it would actually open one of my templates and not some hidden file in a hidden directory. Seems like a bug to me.

Adrian Klaver

unread,
Jul 4, 2014, 3:17:56 PM7/4/14
to spyd...@googlegroups.com
On 07/04/2014 09:56 AM, Rothrock wrote:
> Thank you. That is a little less annoying.
>
> By the way, I'm not getting temp.py I'm getting .temp.py.

I'm using the 2.3rc so I imagine the name has changed.

I would so
> prefer that if it had to open a blank document that it would actually
> open one of my templates and not some hidden file in a hidden directory.

Well the template file lives in the same place:)

> Seems like a bug to me.
>


--
Adrian Klaver
adrian...@aklaver.com

Rothrock

unread,
Jul 15, 2014, 9:48:10 AM7/15/14
to spyd...@googlegroups.com
I've updated to 2.3 and the name is now temp.py (no leading .) but the behavior is still just as annoying. Is this really the desired behavior? And why doesn't it bother anybody else? What am I missing?

Every other app I use -- Office suite, Photoshop, Dreamweaver, even browsers -- either start with no document open or a default (that can usually be set). I can't think of any other thing I do that has a special hidden file that isn't related to the default untitled (new) document.

Can someone explain to me what it is and why it must be there? And why it can't be made to go away?

Adrian Klaver

unread,
Jul 16, 2014, 12:44:38 AM7/16/14
to spyd...@googlegroups.com
Well you could do source modification.

At line 438 of spyderlib/spyderlib/plugins/editor.py is:

else:
self.__load_temp_file()

you could do:

else:
pass
#self.__load_temp_file()

I tested it here and I got a blank Editor in which I could open a file
of my choosing.

>
> --



--
Adrian Klaver
adrian...@aklaver.com

Joseph Martinot-Lagarde

unread,
Jul 16, 2014, 2:53:23 PM7/16/14
to spyd...@googlegroups.com
Le 15/07/2014 15:48, Rothrock a écrit :
> I've updated to 2.3 and the name is now temp.py (no leading .) but the
> behavior is still just as annoying. Is this really the desired behavior?
> And why doesn't it bother anybody else? What am I missing?

I guess that most people (including me) close spyder with opened files
and are happy to find them again at next startup.

>
> Every other app I use -- Office suite, Photoshop, Dreamweaver, even
> browsers -- either start with no document open or a default (that can
> usually be set). I can't think of any other thing I do that has a
> special hidden file that isn't related to the default untitled (new)
> document.
>
> Can someone explain to me what it is and why it must be there? And why
> it can't be made to go away?

Wild guess: at first start (or each start ?), the editor widget would be
empty if no file was opened, so the Qt layout would minimize it.

I agree that it may not be a desirable behavior. Starting with the
template or no file at all would be better.

Adrian Klaver

unread,
Jul 16, 2014, 7:24:15 PM7/16/14
to spyd...@googlegroups.com
On 07/16/2014 11:53 AM, Joseph Martinot-Lagarde wrote:
> Le 15/07/2014 15:48, Rothrock a écrit :
>> I've updated to 2.3 and the name is now temp.py (no leading .) but the
>> behavior is still just as annoying. Is this really the desired behavior?
>> And why doesn't it bother anybody else? What am I missing?
>
> I guess that most people (including me) close spyder with opened files
> and are happy to find them again at next startup.
>
>>
>> Every other app I use -- Office suite, Photoshop, Dreamweaver, even
>> browsers -- either start with no document open or a default (that can
>> usually be set). I can't think of any other thing I do that has a
>> special hidden file that isn't related to the default untitled (new)
>> document.
>>
>> Can someone explain to me what it is and why it must be there? And why
>> it can't be made to go away?
>
> Wild guess: at first start (or each start ?), the editor widget would be
> empty if no file was opened, so the Qt layout would minimize it.

In my tests the Editor was maximized.

>
> I agree that it may not be a desirable behavior. Starting with the
> template or no file at all would be better.

I am currently working my way through the configuration code to see if I
can come up with setting in Preferences to toggle this behavior.

>


--
Adrian Klaver
adrian...@aklaver.com

Rothrock

unread,
Jul 17, 2014, 9:16:13 PM7/17/14
to spyd...@googlegroups.com
Thanks everybody for the help. The edit in the editor.py file was just the ticket.
Reply all
Reply to author
Forward
0 new messages