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報(bào)錯(cuò)KeyError: ‘missing_key‘的有效解決方法
在 Python 編程中,報(bào)錯(cuò)信息常常讓開發(fā)者感到困擾,其中,“KeyError: ‘missing_key’”是一個(gè)較為常見的報(bào)錯(cuò),它可能在各種數(shù)據(jù)處理和字典操作的場(chǎng)景中出現(xiàn),本文將深入探討這個(gè)報(bào)錯(cuò)的原因,并提供多種有效的解決方法,幫助開發(fā)者快速解決此類問(wèn)題2024-10-10
Python學(xué)習(xí)筆記之os模塊使用總結(jié)
這篇文章主要介紹了Python學(xué)習(xí)筆記之os模塊使用總結(jié),本文總結(jié)了多個(gè)常用方法,需要的朋友可以參考下2014-11-11
Python實(shí)現(xiàn)圖像和辦公文檔處理的方法和技巧
本文介紹了Python實(shí)現(xiàn)圖像和辦公文檔處理的方法和技巧,包括使用Pillow庫(kù)處理圖像、使用OpenCV庫(kù)進(jìn)行圖像識(shí)別和處理、使用PyPDF2庫(kù)處理PDF文檔、使用docx和xlwt庫(kù)處理Word和Excel文檔等,幫助讀者更好地掌握Python在圖像和辦公文檔處理方面的應(yīng)用2023-05-05
Python實(shí)現(xiàn)將HTML轉(zhuǎn)成PDF的方法分析
這篇文章主要介紹了Python實(shí)現(xiàn)將HTML轉(zhuǎn)成PDF的方法,結(jié)合實(shí)例形式分析了Python基于pdfkit模塊實(shí)現(xiàn)HTML轉(zhuǎn)換成PDF文件的相關(guān)操作技巧與注意事項(xiàng),需要的朋友可以參考下2019-05-05

