question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autopep8 crashes on PermissionError

See original GitHub issue

Description

What steps will reproduce the problem?

Saving a file with reformatting on save using autopep8 does nothing, except when there is a syntax error in the file, in which case Spyder “encounters an internal error”.

Traceback

Traceback (most recent call last):
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\spyder\utils\encoding.py", line 277, in write
    textfile.write(text)
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\contextlib.py", line 120, in __exit__
    next(self.gen)
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\atomicwrites\__init__.py", line 169, in _open
    self.commit(f)
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\atomicwrites\__init__.py", line 202, in commit
    replace_atomic(f.name, self._path)
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\atomicwrites\__init__.py", line 99, in replace_atomic
    return _replace_atomic(src, dst)
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\atomicwrites\__init__.py", line 79, in _replace_atomic
    _handle_errors(windll.kernel32.MoveFileExW(
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\atomicwrites\__init__.py", line 76, in _handle_errors
    raise WinError()
PermissionError: [WinError 5] Access is denied.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 1878, in _save_file
    self._write_to_file(finfo, finfo.filename)
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 1808, in _write_to_file
    fileinfo.encoding = encoding.write(txt, filename, fileinfo.encoding)
  File "C:\Users\bobmc\anaconda3\envs\phys516\lib\site-packages\spyder\utils\encoding.py", line 282, in write
    with open(absolute_filename, mode) as textfile:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\bobmc\\OneDrive - PennO365\\UPenn\\2021-01 Spring\\PHYS 516 - Electromagnetic Phenomena\\Final\\Final.py'

Versions

  • Spyder version: 5.0.1
  • Python version: 3.8.8
  • Qt version: 5.12.9
  • PyQt5 version: 5.12.3
  • Operating System: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.6.0               :  7.19.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.1 (OK)
nbconvert >=4.0               :  6.0.7 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.7.2 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.8.1 (OK)
pylint >=1.0                  :  2.7.2 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2           :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.0 (OK)
qtawesome >=1.0.2             :  1.0.2 (OK)
qtconsole >=5.0.3             :  5.1.0 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.8.3                 :  0.9.7 (OK)
setuptools >=39.0.0           :  49.6.0.post20210108 (OK)
sphinx >=0.6.6                :  3.5.3 (OK)
spyder_kernels >=2.0.1;<2.1.0 :  2.0.2 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0      :  1.0.2 (OK)
zmq >=17                      :  22.0.3 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=2.0.0            :  3.3.3 (OK)
numpy >=1.7                   :  1.19.5 (OK)
pandas >=1.1.1                :  1.2.0 (OK)
scipy >=0.17.0                :  1.6.0 (OK)
sympy >=0.7.3                 :  1.7.1 (OK)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
LimeHunter7commented, May 11, 2021

This fixed it, thanks.

1reaction
spyder-botcommented, May 5, 2021

Thanks for reporting. To fix this, please open the Anaconda Prompt and run there the following commands:

conda update anaconda
conda install jupyter_client=5.3.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

I am developing a kivymd app but app is crashing after taking ...
I am developing an android app in kivymd . but when I am testing it .it's crashing in some device and running fine...
Read more >
The Python Tools server crashed 5 times in the last 3 minutes ...
ms-python.python v2021.5.842923320 is still crashing and printing the error above. I'm working with the Remote - SSH package.
Read more >
Issue 21775: shutil.copytree() crashes copying to VFAT on ...
When using shutil.copytree() on Linux to copy to a VFAT filesystem, it crashes like this: Traceback (most recent call last): File ...
Read more >
autopep8 0.8.2 - PyPI
A tool that automatically formats Python code to conform to the PEP 8 style guide.
Read more >
autopep8 - Visual Studio Marketplace
Extension for Visual Studio Code - Formatting support for python files using `autopep8`.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found