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.

Black doesn't autoformat code on save

See original GitHub issue

Problem Description

I updated Spyder to the latest version. Now I get a popup “completion and linting in the editor spyder error”, like this:

PXJpR

which I guess prevents Black from operating.

In the preferences I have the box ticked to autoformat code on save via Black, but nothing happens on save. Selecting some code lines and right clicking on the editor has the option for Black disabled (you cannot click on it) - same with the shortcut.

According to this SO post, this might be a firewall problem, but that doesn’t apply to me because the firewall options are managed by my organization, and nothing has changed in my Windows 10 desktop.

This broke when I updated Spyder. Can you please help?

Versions

  • Spyder version: 5.3.0
  • Python version: 3.8.10
  • Qt version: 5.15.2
  • PyQt version: 5.15.6
  • OS version: Windows 10

Dependencies

Dependencies
# Mandatory:
atomicwrites >=1.2.0                 :  1.4.0 (OK)
chardet >=2.0.0                      :  4.0.0 (OK)
cloudpickle >=0.5.0                  :  2.0.0 (OK)
cookiecutter >=1.6.0                 :  1.7.3 (OK)
diff_match_patch >=20181111          :  20200713 (OK)
intervaltree                         :  None (OK)
IPython >=7.31.1;<8.0.0              :  7.32.0 (OK)
jedi >=0.17.2;<0.19.0                :  0.18.1 (OK)
jellyfish >=0.7                      :  0.9.0 (OK)
jsonschema >=3.2.0                   :  4.4.0 (OK)
keyring >=17.0.0                     :  23.5.0 (OK)
nbconvert >=4.0                      :  6.4.5 (OK)
numpydoc >=0.6.0                     :  1.2.1 (OK)
paramiko >=2.4.0                     :  2.10.3 (OK)
parso >=0.7.0;<0.9.0                 :  0.8.3 (OK)
pexpect >=4.4.0                      :  4.8.0 (OK)
pickleshare >=0.4                    :  0.7.5 (OK)
psutil >=5.3                         :  5.9.0 (OK)
pygments >=2.0                       :  2.11.2 (OK)
pylint >=2.5.0                       :  2.13.3 (OK)
pyls_spyder >=0.4.0                  :  0.4.0 (OK)
pylsp >=1.4.1;<1.5.0                 :  1.4.1 (OK)
pylsp_black >=1.2.0                  :  1.2.0 (OK)
qdarkstyle >=3.0.2;<3.1.0            :  3.0.3 (OK)
qstylizer >=0.1.10                   :  0.2.1 (OK)
qtawesome >=1.0.2                    :  1.1.1 (OK)
qtconsole >=5.3.0;<5.4.0             :  5.3.0 (OK)
qtpy >=2.0.1                         :  2.0.1 (OK)
rtree >=0.9.7                        :  0.9.7 (OK)
setuptools >=49.6.0                  :  61.2.0 (OK)
sphinx >=0.6.6                       :  4.5.0 (OK)
spyder_kernels >=2.3.0;<2.4.0        :  2.3.0 (OK)
textdistance >=4.2.0                 :  4.2.2 (OK)
three_merge >=0.1.1                  :  0.1.1 (OK)
watchdog                             :  2.1.7 (OK)
zmq >=17                             :  22.3.0 (OK)

# Optional:
cython >=0.21                        :  0.29.28 (OK)
matplotlib >=3.0.0                   :  3.5.1 (OK)
numpy >=1.7                          :  1.22.3 (OK)
pandas >=1.1.1                       :  1.4.1 (OK)
scipy >=0.17.0                       :  1.8.0 (OK)
sympy >=0.7.3                        :  1.10.1 (OK)

# Spyder plugins:
spyder_terminal.terminalplugin 1.2.2 :  1.2.2 (OK)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
gsamarascommented, Apr 15, 2022

So I deleted everything and started fresh, now all it’s good, thanks for your help!

0reactions
dalthvizcommented, Apr 14, 2022

Well the UserWarning means that somehow there are more files in the installation than expected. Could you manually uninstall Spyder and reinstall it please? Not totally sure how but seems like your previous installation left some files and then reusing the installation directory caused some files appear as duplicated.

Checking on my local installation with the installer I have only libopenblas.EL2C6PLE4ZYW3ECEVIV3OXXGRN2NRFM2.gfortran-win_amd64.dll

Maybe after unistalling you could check if C:\Users\gsamaras\AppData\Local\Programs\Spyder is actually empty or doesn’t exist and if that is not the case remove it manually.

Let us know if something of the above helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatter black is not working on my VSCode...but why?
I use Black from inside VSCode and it rocks. It frees mental cycles that you would spend deciding how to format your code....
Read more >
VSCode: Using Black to automatically format Python
Open your VSCode settings, by going 'Code -> Preferences -> Settings'. Black will now format your code whenever you save a *. py...
Read more >
Black formatting is not applied (but black runs) #18561 - GitHub
I can see in the log black being run without error but no changes are applied to my file. Output of python after...
Read more >
Using Black to automatically format Python VSCode - YouTube
Black is "the uncompromising Python code formatter." It can be configured to automatically format your code whenever you save a file in ...
Read more >
Editing Python in Visual Studio Code
Troubleshooting formatting ; The formatter is not installed in the current environment. Open a command prompt, navigate to the location where your selected ......
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