Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spyder can't start/saving preferences if user home dir is not writable on Windows #1086

Closed
spyder-bot opened this issue Feb 17, 2015 · 12 comments

Comments

@spyder-bot
Copy link
Collaborator

From ondrej.c...@gmail.com on 2012-06-08T09:23:41Z

Spyder Version: 2.1.9
Python Version: 2.7.2
Qt Version: 4.7.4, PyQt4 (API v1) 4.8.6 on Windows

What steps will reproduce the problem?

  1. starting spyder - either from the command window, or using Python(x,y) home, requires several attempts until it successfully starts.
    1. the preferences cannot be saved.
      The output is identical: the Spyder apparently wants to open a file in my user documents, but Win7 (64 bit) do not like it. The same Spyder&Python runs flawlessly on my old home computer (XP, 32 bit). What is the expected output? What do you see instead? Expected: spyder starts; spyder would save the preferences.
      Seen: multiple attempts before spyder starts. The "save preferences" dialog raises the same error message:

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.

Traceback (most recent call last):
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 155, in accept
configpage.apply_changes()
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 71, in apply_changes
self.save_to_conf()
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 315, in save_to_conf
self.set_option(option, spinbox.value())
File "C:\Python27\lib\site-packages\spyderlib\plugins__init__.py", line 210, in set_option
CONF.set(self.CONF_SECTION, str(option), value)
File "C:\Python27\lib\site-packages\spyderlib\userconfig.py", line 310, in set
self.save()
File "C:\Python27\lib\site-packages\spyderlib\userconfig.py", line 154, in __save
conf_file = file(self.filename(),'w')
IOError: [Errno 22] invalid mode ('w') or filename: 'C:\Users\cineko.FNMOTOL2W.spyder2.spyder.ini'
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 155, in accept
configpage.apply_changes()
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 71, in apply_changes
self.save_to_conf()
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 309, in save_to_conf
self.set_option(option, checkbox.isChecked())
File "C:\Python27\lib\site-packages\spyderlib\plugins__init
.py", line 210, in set_option
CONF.set(self.CONF_SECTION, str(option), value)
File "C:\Python27\lib\site-packages\spyderlib\userconfig.py", line 310, in set
self.save()
File "C:\Python27\lib\site-packages\spyderlib\userconfig.py", line 154, in __save
conf_file = file(self.filename(),'w')
IOError: [Errno 22] invalid mode ('w') or filename: 'C:\Users\cineko.FNMOTOL2W.spyder2.spyder.ini'
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 155, in accept
configpage.apply_changes()
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 71, in apply_changes
self.save_to_conf()
File "C:\Python27\lib\site-packages\spyderlib\plugins\configdialog.py", line 309, in save_to_conf
self.set_option(option, checkbox.isChecked())
File "C:\Python27\lib\site-packages\spyderlib\plugins__init
.py", line 210, in set_option
CONF.set(self.CONF_SECTION, str(option), value)
File "C:\Python27\lib\site-packages\spyderlib\userconfig.py", line 310, in set
self.__save()
File "C:\Python27\lib\site-packages\spyderlib\userconfig.py", line 154, in __save
conf_file = file(self.filename(),'w')
IOError: [Errno 22] invalid mode ('w') or filename: 'C:\Users\cineko.FNMOTOL2W.spyder2.spyder.ini'

Please provide any additional information below

.

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1086

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2012-06-08T08:59:13Z

Well, your user directory has to be writable so that Spyder can save its settings permanently. Where are you saving your documents instead of it?

Still worse is that on Windows we can't use a temporal directory because it is defined inside your user dir.

Summary: Spyder can't start/saving preferences if user home dir is not writable on Windows
Labels: -Priority-Medium Priority-Low OpSys-Windows

@spyder-bot
Copy link
Collaborator Author

From ondrej.c...@gmail.com on 2012-06-08T10:12:31Z

Well, this directory actually is writable. It is something else. I am afraid this issue has emerged some time ago on this forum, but never solved, as far as I understood.

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2012-06-08T21:11:25Z

Ok, I vaguely remember something along these lines but I don't use Windows so I can't be of much help.

Jed, would you mind to try to see what happens? My first guess is that this could be caused by an antivirus or something which senses something wrong with our .ini file.

Ondrej, last question: does the directory .spyder2 gets created in your user dir or not?

Cc: jed.lud...@gmail.com

@spyder-bot
Copy link
Collaborator Author

From jed.lud...@gmail.com on 2012-06-09T15:56:34Z

A similar problem was reported in the discussion group late last year, and it was ultimately traced to Fortinet virus protection software. See the discussion here: https://groups.google.com/d/topic/spyderlib/upzevMIpjyY/discussion @-ondrej: Could you try to disable any virus protection and see what happens?

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-08-21T00:50:09Z

A workaround was suggested by Vadim Sultanov in the discussion group recently: https://groups.google.com/forum/#!msg/spyderlib/a_P9JBJEZeE/gOK_Pr2WbE8J I'm adding this to the two repositories (v21 and default).

Status: Started

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-08-21T00:57:43Z

This issue was updated by revision b6bc3a102be2 .

This is just a workaround. Even if it seems harmless, a confirmation of whether
it's working or not is much welcome.

Status: Fixed

@spyder-bot
Copy link
Collaborator Author

From bwanama...@gmail.com on 2013-01-23T11:31:24Z

My solution is here:

--- userconfig - Copy.py Sat Jan 5 06:31:28 2013
+++ userconfig.py Wed Jan 23 10:53:16 2013
@@ -160,13 +160,15 @@
"""
fname = self.filename()

  •    # import pdb;pdb.set_trace()
     # See comment `#5` on issue #1086 -        if osp.isfile(fname):
    
  •        os.remove(fname)
    
  •    # if osp.isfile(fname):
    
  •    #     os.remove(fname)
    
  •    conf_file = file(fname, 'w')
    
  •    self.write(conf_file)
    
  •    conf_file.close()
    
  •    #conf_file = file(fname, 'w')
    
  •    with open(fname, 'w') as conf_file:
    
  •        self.write(conf_file)
    
  •    #conf_file.close()
    

    def filename(self):
    """

Note that I commented out the patch from commit b6bc3a102be2, and I didn't need (not sure if it's needed) the patch from commit 1fc0b9c4a621.

Attachment: spyderlib_userconfig.patch

@spyder-bot
Copy link
Collaborator Author

From jed.lud...@gmail.com on 2013-01-23T16:14:07Z

This issue was updated by revision d9438fb9d937 .

@spyder-bot
Copy link
Collaborator Author

From jed.lud...@gmail.com on 2013-01-23T16:19:21Z

I've applied the above patch from @-bwanamarko to the default repository.

See additional discussion at this thread: https://groups.google.com/forum/#!topic/spyderlib/QbLCrr8mXaw This discussion was in reference to version 2.1.13. Ironically, Pierre had already made an equivalent change to the tip of the v21 repository some time after the 2.1.13 tag, so no need to make any additional changes there.

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-01-24T16:59:22Z

Labels: MS-v2.2

@spyder-bot
Copy link
Collaborator Author

From jed.lud...@gmail.com on 2013-01-30T22:06:39Z

issue #1242 has been merged into this issue.

@spyder-bot
Copy link
Collaborator Author

From jed.lud...@gmail.com on 2013-02-05T16:39:41Z

Moving this discussion over to issue #1242 . Let's move all future discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant