vscode autopep8無法格式化python代碼問題解決
示例
import requests url='http://xxx:15672/api/queues/vobile-it?page=1&page_size=100&name=&use_regex=false&sort=messages&sort_reverse=true&pagination=true' response=requests.get(url) items:list[dict]=response.json()['items'] items
手動(dòng)輸入autopep8
上面的代碼,死活無法用快捷鍵格式化,所以手動(dòng)輸入autopep8看看
╰─? autopep8 dev/rabbtimq_queues.py --in-place 130 ?
Traceback (most recent call last):
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/bin/autopep8", line 8, in <module>
sys.exit(main())
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 4548, in main
results = fix_multiple_files(args.files, args, sys.stdout)
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 4443, in fix_multiple_files
ret = _fix_file((name, options, output))
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 4413, in _fix_file
return fix_file(*parameters)
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 3615, in fix_file
fixed_source = fix_lines(fixed_source, options, filename=filename)
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 3595, in fix_lines
fixed_source = fix.fix()
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 618, in fix
self._fix_source(filter_results(source=''.join(self.source),
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 562, in _fix_source
modified_lines = fix(result)
File "/Users/ponponon/.local/share/virtualenvs/crawler_console-J8uqt1Xz/lib/python3.10/site-packages/autopep8.py", line 766, in fix_e225
pycodestyle.missing_whitespace_around_operator(fixed, ts))
AttributeError: module 'pycodestyle' has no attribute 'missing_whitespace_around_operator'. Did you mean: 'whitespace_around_operator'?懶得去管是哪個(gè)模塊引起的問題了
先無腦升級(jí)第三方試試
─? pip install --upgrade -r requirements-dev.txt && pip install --upgrade -r requirements-prd.txt
升級(jí)之后,問題就解決了
以上就是vscode autopep8無法格式化python代碼問題解決的詳細(xì)內(nèi)容,更多關(guān)于vscode autopep8格式化python的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
對(duì)python cv2批量灰度圖片并保存的實(shí)例講解
今天小編就為大家分享一篇對(duì)python cv2批量灰度圖片并保存的實(shí)例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-11-11
Python開發(fā)微信公眾平臺(tái)的方法詳解【基于weixin-knife】
這篇文章主要介紹了Python開發(fā)微信公眾平臺(tái)的方法,結(jié)合實(shí)例形式分析了Python基于weixin-knife針對(duì)微信公眾平臺(tái)消息、接口調(diào)用及事件處理的基本操作技巧與相關(guān)注意事項(xiàng),需要的朋友可以參考下2017-07-07
Python安裝本地.whl文件的流程及注意事項(xiàng)
在Python的生態(tài)環(huán)境中.whl文件是一種預(yù)編譯的二進(jìn)制包,用于分發(fā)和安裝Python庫,這篇文章主要給大家介紹了關(guān)于Python安裝本地.whl文件的流程及注意事項(xiàng),文中講解了下載文件、安裝pip、使用pip安裝whl文件、驗(yàn)證安裝以及注意事項(xiàng),需要的朋友可以參考下2024-11-11
python多進(jìn)程執(zhí)行方法apply_async使用說明
這篇文章主要介紹了python多進(jìn)程執(zhí)行方法apply_async使用說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2021-03-03
pyinstaller 3.6版本通過pip安裝失敗的解決辦法(推薦)
這篇文章主要介紹了pyinstaller 3.6版本通過pip安裝失敗的解決辦法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-01-01
Django+RestFramework API接口及接口文檔并返回json數(shù)據(jù)操作
這篇文章主要介紹了Django+RestFramework API接口及接口文檔并返回json數(shù)據(jù)操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-07-07
Python腳本實(shí)現(xiàn)定時(shí)監(jiān)控端口
這篇文章主要為大家詳細(xì)介紹了如何使用Python腳本實(shí)現(xiàn)定時(shí)監(jiān)控端口功能,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2025-03-03
Python實(shí)現(xiàn)TXT數(shù)據(jù)轉(zhuǎn)三維矩陣
在數(shù)據(jù)處理和分析中,將文本文件中的數(shù)據(jù)轉(zhuǎn)換為三維矩陣是一個(gè)常見的任務(wù),本文將詳細(xì)介紹如何使用Python實(shí)現(xiàn)這一任務(wù),感興趣的小伙伴可以了解下2024-01-01

