VSCode中autopep8無(wú)法運(yùn)行問(wèn)題解決方案(提示Error: Command failed,usage)
錯(cuò)誤現(xiàn)象:autopep8無(wú)法運(yùn)行,運(yùn)行后vscode右下角提示
Error: Command failed: autopep8 c:\Users\Administrator\Desktop\Python\第1章 概述\1-10.py usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename] [--ignore-local-config] [-r] [-j n] [-p n] [-a] [--experimental] [--exclude globs] [--list-fixes] [--ignore errors] [--select errors] [--max-line-length n] [--line-range line line] [--hang-closing] [--exit-code] [files [files ...]] autopep8: error: autopep8 only takes one filename as argument unless the "--in-place" or "--diff" args are used
usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename] [--ignore-local-config] [-r] [-j n] [-p n] [-a] [--experimental] [--exclude globs] [--list-fixes] [--ignore errors] [--select errors] [--max-line-length n] [--line-range line line] [--hang-closing] [--exit-code] [files [files ...]] autopep8: error: autopep8 only takes one filename as argument unless the "--in-place" or "--diff" args are used
錯(cuò)誤原因 :
文件路徑中包含有空格!
VSCode中autopep8插件運(yùn)行無(wú)效問(wèn)題解決(插件運(yùn)行,但不格式化代碼)
問(wèn)題現(xiàn)象:運(yùn)行autopep8之后,提示插件正常運(yùn)行,但是代碼沒(méi)有任何變化。
問(wèn)題解決過(guò)程:
1.首先在命令行中使用autopep8 文件路徑.py進(jìn)行測(cè)試,運(yùn)行后命令行中顯示所有代碼,但未格式化文檔。
2.根據(jù)運(yùn)行autopep8的命令幫助以及網(wǎng)絡(luò)查詢可知,autopep8運(yùn)行時(shí)應(yīng)加上--in-place --aggressive參數(shù)
命令格式即為 autopep8 --in-place --aggressive 文件路徑名.py
命令行中運(yùn)行autopep8問(wèn)題解決!
3.如何在VSCode中為autopep8增加參數(shù)?
嘗試在preference>setting中設(shè)置autopep8Args,但是無(wú)效!
搜索文件找到C:\Users\Administrator\.vscode\extensions\himanoa.python-autopep8-1.0.2目錄,即擴(kuò)展安裝目錄。
打開extension.js文件。
找到
exec('autopep8 ' + filename, function(error, stdout, stderr){
將其修改為
exec('autopep8 --in-place --aggressive ' + filename, function(error, stdout, stderr){
重啟VSCode,問(wèn)題解決!
到此這篇關(guān)于VSCode中autopep8無(wú)法運(yùn)行問(wèn)題解決方案(提示Error: Command failed,usage)的文章就介紹到這了,更多相關(guān)VSCode autopep8無(wú)法運(yùn)行內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- VSCode遠(yuǎn)程連接服務(wù)器報(bào)錯(cuò):Could not establish connection to
- vscode通過(guò)Remote SSH遠(yuǎn)程連接及離線配置的方法
- 使用VSCode的Remote-SSH連接Linux進(jìn)行遠(yuǎn)程開發(fā)
- 使用VSCode和SSH進(jìn)行遠(yuǎn)程開發(fā)
- VSCode 遠(yuǎn)程登錄開發(fā)(帶免密)
- vscode中配置jupyter的詳細(xì)步驟(徹底解決Failed?to?start?the?Kernel問(wèn)題)
- VSCode遠(yuǎn)程XHR failed無(wú)法連接的問(wèn)題及解決方案
相關(guān)文章
python與mysql數(shù)據(jù)庫(kù)交互的實(shí)現(xiàn)
這篇文章主要介紹了python與mysql數(shù)據(jù)庫(kù)交互的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-01-01python必學(xué)知識(shí)之文件操作(建議收藏)
python中對(duì)文件、文件夾(文件操作函數(shù))的操作需要涉及到os模塊和shutil模塊。下面這篇文章主要給大家介紹了關(guān)于python必學(xué)知識(shí)之文件操作的相關(guān)資料,需要的朋友可以參考下2021-05-05Python使用os.listdir和os.walk獲取文件路徑
這篇文章主要介紹了Python使用os.listdir和os.walk獲取文件路徑,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-05-05Python中單引號(hào)、雙引號(hào)和三引號(hào)具體的用法及注意點(diǎn)
這篇文章主要給大家介紹了關(guān)于Python中單引號(hào)、雙引號(hào)和三引號(hào)具體的用法及注意點(diǎn)的相關(guān)資料,Python中單引號(hào)、雙引號(hào)、三引號(hào)中使用常常困惑,想弄明白這三者相同點(diǎn)和不同點(diǎn),需要的朋友可以參考下2023-07-07win10+anaconda安裝yolov5的方法及問(wèn)題解決方案
這篇文章主要介紹了win10+anaconda安裝yolov5的方法及問(wèn)題解決方案,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-04-04在django中查詢獲取數(shù)據(jù),get, filter,all(),values()操作
這篇文章主要介紹了在django中查詢獲取數(shù)據(jù),get, filter,all(),values()操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-08-08Python實(shí)現(xiàn)視頻字幕時(shí)間軸格式轉(zhuǎn)換的示例
本文主要介紹了Python實(shí)現(xiàn)視頻字幕時(shí)間軸格式轉(zhuǎn)換的示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-11-11