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

FileNotFoundError generated for template.py #5717

Closed
edilbertgoudinho opened this issue Nov 10, 2017 · 7 comments
Closed

FileNotFoundError generated for template.py #5717

edilbertgoudinho opened this issue Nov 10, 2017 · 7 comments

Comments

@edilbertgoudinho
Copy link

Description

What steps will reproduce the problem?

What is the expected output? What do you see instead?

Please provide any additional information below

File "C:\ProgramData\Anaconda3\envs\MyProjects\lib\site-packages\spyder\plugins\editor.py", line 1712, in new
text, enc = encoding.read(self.TEMPLATE_PATH)
File "C:\ProgramData\Anaconda3\envs\MyProjects\lib\site-packages\spyder\utils\encoding.py", line 243, in read
text, encoding = decode( open(filename, 'rb').read() )
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Edilbert\.spyder-py3\template.py'

Version and main components

  • Spyder Version: 3.2.4
  • Python Version: 3.6.3
  • Qt Versions: 5.6.2, PyQt5 5.6 on Windows

Dependencies

pyflakes >=0.6.0 :  1.6.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.3 (OK)
numpy >=1.7      :  1.13.3 (OK)
sphinx >=0.6.6   :  1.6.3 (OK)
rope >=0.9.4     :  0.10.5 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
sympy >=0.7.3    :  None (NOK)
cython >=0.21    :  None (NOK)
qtconsole >=4.2.0:  4.3.1 (OK)
IPython >=4.0    :  6.1.0 (OK)
pylint >=0.25    :  1.7.4 (OK)

@CAMGerlach-Baron
Copy link

I'm still new to Spyder myself, but this (perhaps naively) appears at least partially recognizable. Was this just launching Spyder, or did you try to create a new file? A quick look at your error is sufficient to guess at the proximate cause: it would seem that spyder couldn't read the template file it uses to create a new file (normally located at "C:\Users\[Username]\.spyder-py3\template.py"; in this case Spyder is looking for it at 'C:\Users\Edilbert\.spyder-py3\template.py') and thus experienced an error.

More detail (or really, any detail) about the circumstances during which this error occurred would likely be of help in diagnosing this further, and determining the root cause (as it could conceivably be that simply something happened to just this file, or this is a symptom of some deeper issue with your Spyder install), and to start with you could report whether the file and directory in question exists, and (if at least the latter is true) creating a fresh file with that name with some dummy text and seeing if the problem (or what problem) reoccurs in the same circumstances.

Again, I'm new to Spyder so the actual problem may be something much deeper entirely, but hopefully this is of some help to get started.

@ccordoba12 ccordoba12 added this to the v3.2.5 milestone Nov 10, 2017
@ccordoba12 ccordoba12 changed the title Error FileNotFoundError generated for template.py Nov 10, 2017
@ccordoba12
Copy link
Member

@CAMGerlach-Baron, thanks for chiming in. I think you're right about the source of this error. My gut feeling tells me that this could be generated by an antivirus issue, which is removing the template file from the filesystem while Spyder is running.

I really don't have any other explanation for this...

@ccordoba12 ccordoba12 mentioned this issue Dec 4, 2017
@ccordoba12 ccordoba12 modified the milestones: v3.2.5, v3.2.6 Dec 6, 2017
This was referenced Dec 21, 2017
@ccordoba12 ccordoba12 modified the milestones: v3.2.6, v3.2.7 Dec 29, 2017
@CAM-Gerlach CAM-Gerlach mentioned this issue Jan 2, 2018
@ccordoba12
Copy link
Member

@CAMGerlach-Baron, I think this is a Windows only issue and it happens when people installs Anaconda as Administrator on Windows and then runs it for a particular user.

Could you try to reproduce it with a clean config, please?

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Jan 2, 2018

@ccordoba12 My current home machine is set up that way, Anaconda installed as admin/"For all users", and then running on the local account. I haven't seen this issue prior, so I logged in via a clean, non-admin user account I use for troubleshooting, different from the one I installed it on, and it didn't have any issue running spyder or creating/saving a new file either from the command line or Anaconda navigator.

I can certainly go beyond this in testing, Would you like me to try installing Spyder in a fresh environment under that user account, and then trying again? Or should I do a complete uninstall of Anaconda and it when logged in as the clean non-Admin user, using my Admin rights to install, and then trying to run Spyder from that account? Given its a fairly big step, I want to be clear on the procedure you think most likely to reproduce it. Thanks!

@ccordoba12
Copy link
Member

I think this is a permissions error, so the problem should appear if you install Anaconda for your user as Admin, then try to use it with an unprivileged user.

@ccordoba12
Copy link
Member

Although I don't know if that's possible.

@CAMGerlach-Baron
Copy link

@ccordoba12 Okay thanks. It is indeed possible, as that is essentially what I did on my machine. I originally installed Anaconda with my admin account a few months back, use Spyder regularly with my normal account, and then just tried running Spyder with another clean, unprivileged user account and it worked just fine, and I've never seen this issue.

One thing I didn't try, which I can do when I get home tonight, is uninstall Anaconda with my admin account, then log in to the clean temp account, launch the installer, and then tell it to install for all users, elevating with UAC (like Windows sudo) as need be (versus originally, when I was actually logged in to my admin account when I installed it, and first used it there). It could be something with the UAC substitute process giving the files the wrong permissions or ownership, or something. Other than that, I don't know.

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

4 participants