错误现象:autopep8无法运行,运行后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
错误原因 :
文件路径中包含有空格!
VSCode中autopep8插件运行无效问题解决(插件运行,但不格式化代码)
问题现象:运行autopep8之后,提示插件正常运行,但是代码没有任何变化。
问题解决过程:
1.首先在命令行中使用autopep8 文件路径.py进行测试,运行后命令行中显示所有代码,但未格式化文档。
2.根据运行autopep8的命令帮助以及网络查询可知,autopep8运行时应加上--in-place --aggressive参数
命令格式即为 autopep8 --in-place --aggressive 文件路径名.py
命令行中运行autopep8问题解决!
3.如何在VSCode中为autopep8增加参数?
尝试在preference>setting中设置autopep8Args,但是无效!
搜索文件找到C:\Users\Administrator\.vscode\extensions\himanoa.python-autopep8-1.0.2目录,即扩展安装目录。
打开extension.js文件。
找到
exec('autopep8 ' + filename, function(error, stdout, stderr){
将其修改为
exec('autopep8 --in-place --aggressive ' + filename, function(error, stdout, stderr){
重启VSCode,问题解决!
更新日志
- 群星.2011《高雄国际Hi-End音响大展纪念发烧金碟》[WAV分轨]
- 康康1999-催泪[阿尔法][WAV+CUE]
- 和守望先锋太像?《星鸣特攻》开发商:我们与众不同
- 速通玩家有福了!夏季游戏速通大会正在火热进行中
- 《使命召唤》新处决动作曝光 或联动《死侍3》?
- 《陈百强出道35周年 文质翩翩》4CD[WAV+CUE][1.8GB]
- 邓丽君《思君集》3CD[WAV+CUE][1.2GB]
- 华语流行S.H.E《12CD》2001~2010[APE+CUE][3.7GB]
- 北风之望饮品怎么调配?饮品调酒配方分享
- 原画壁纸及美图第254期,无水印可自取
- 原画壁纸及美图第255期,无水印可自取
- 群星.1991-宝丽金冬日浓情【宝丽金】【WAV+CUE】
- 胡杨林.2006-香水有毒【太格印象】【WAV+CUE】
- 陈晓东.2002-从未忘记2CD【环球】【WAV+CUE】
- 绝区零珂蕾妲阵容怎么搭配好 珂蕾妲队伍搭配攻略