Error when using Autopep8
Not sure as to why the formatting fails with autopep8 (with python3).
My config:
let g:neoformat_python_autopep8 = {
\ 'exe': 'autopep8.exe',
\ 'args': ['--indent-size=2', '--max-line-length=120'],
\ 'replace': 1,
\ 'stdin': 0,
\ 'env': [""],
\ 'valid_exit_codes': [0, 23],
\ 'no_append': 1,
\ }
" DEBUG=1 not using for powershell
let g:neoformat_enabled_python = ['autopep8']
The detailed log from neoformat is here:
Neoformat: ['#!/usr/bin/env python3', '# -*- coding: utf-8 -*-', '', 'import os', 'import pyoo', 'from subprocess import PIPE, Popen, run', '', '', 'def startsofficeserver():', ' print("Staring SOFFICE Server")', ' proc = Popen([''soffice'',', ' ''--accept="socket,host=localhost,port=2002;urp;"'',', ' ''--norestore'',', ' ''--nologo'',', ' ''--nodefault'',', ' ''--headless'',', ' ''&''])', ' try:', ' outs, errs = proc.communicate(timeout=15)', ' except TimeoutExpired:', ' print("Exception found TimeoutExpired inside startsofficeserver()")', ' proc.kill()', ' outs, errs = proc.communicate()', '', '', 'def shutdownsoffieserver():', ' print("ShuttingDown SOFFICE Server")', ' p1 = Popen([''pidof'', ''/usr/lib/libreoffice/program/soffice.bin''], stdout=PIPE)', ' proc = Popen([''xargs'', ''kill'', ''-9''], stdin=p1.stdout, stdout=PIPE)', ' p1.stdout.close()', ' try:', ' outs, errs = proc.communicate(timeout=15)', ' except TimeoutExpired:', ' print("Exception found TimeoutExpired inside shutdownsoffieserver()")', ' proc.kill()', ' outs, errs = proc.communicate()', '', '', 'def main():', ' startsofficeserver()', ' shutdownsoffieserver()', '', '', 'if __name__ == "__main__":', ' main()']
Neoformat: autopep8.exe --indent-size=2 --max-line-length=120 2> C:\Users\username\AppData\Local\Temp\neoformat\stderr.log
Neoformat: using tmp file
Neoformat: ['#!/usr/bin/env python3', '# -*- coding: utf-8 -*-', '', 'import os', 'import pyoo', 'from subprocess import PIPE, Popen, run', '', '', 'def startsofficeserver():', ' print("Staring SOFFICE Server")', ' proc = Popen([''soffice'',', ' ''--accept="socket,host=localhost,port=2002;urp;"'',', ' ''--norestore'',', ' ''--nologo'',', ' ''--nodefault'',', ' ''--headless'',', ' ''&''])', ' try:', ' outs, errs = proc.communicate(timeout=15)', ' except TimeoutExpired:', ' print("Exception found TimeoutExpired inside startsofficeserver()")', ' proc.kill()', ' outs, errs = proc.communicate()', '', '', 'def shutdownsoffieserver():', ' print("ShuttingDown SOFFICE Server")', ' p1 = Popen([''pidof'', ''/usr/lib/libreoffice/program/soffice.bin''], stdout=PIPE)', ' proc = Popen([''xargs'', ''kill'', ''-9''], stdin=p1.stdout, stdout=PIPE)', ' p1.stdout.close()', ' try:', ' outs, errs = proc.communicate(timeout=15)', ' except TimeoutExpired:', ' print("Exception found TimeoutExpired inside shutdownsoffieserver()")', ' proc.kill()', ' outs, errs = proc.communicate()', '', '', 'def main():', ' startsofficeserver()', ' shutdownsoffieserver()', '', '', 'if __name__ == "__main__":', ' main()']
Neoformat: [0, 23]
Neoformat: 2
Neoformat: stderr output redirected to fileC:\Users\username\AppData\Local\Temp\neoformat\stderr.log
Neoformat: ['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: incorrect number of arguments']
Neoformat: 2
Neoformat: trying next formatter
Neoformat: formatters autopep8.exe failed to run
After chaning stdin: 1 in the dict g:neoformat_python_autopep8, I end with the following error:
Neoformat: ['#!/usr/bin/env python3', '# -*- coding: utf-8 -*-', '', 'import os', 'import pyoo', 'from subprocess import PIPE, Popen, run', '', '', 'def startsofficeserver():', ' print("Staring SOFFICE Server")', ' proc = Popen([''soffice'',', ' ''--accept="socket,host=localhost,port=2002;urp;"'',', ' ''--norestore'',', ' ''--nologo'',', ' ''--nodefault'',', ' ''--headless'',', ' ''&''])', ' try:', ' outs, errs = proc.communicate(timeout=15)', ' except TimeoutExpired:', ' print("Exception found TimeoutExpired inside startsofficeserver()")', ' proc.kill()', ' outs, errs = proc.communicate()', '', '', 'def shutdownsoffieserver():', ' print("ShuttingDown SOFFICE Server")', ' p1 = Popen([''pidof'', ''/usr/lib/libreoffice/program/soffice.bin''], stdout=PIPE)', ' proc = Popen([''xargs'', ''kill'', ''-9''], stdin=p1.stdout, stdout=PIPE)', ' p1.stdout.close()', ' try:', ' outs, errs = proc.communicate(timeout=15)', ' except TimeoutExpired:', ' print("Exception found TimeoutExpired inside shutdownsoffieserver()")', ' proc.kill()', ' outs, errs = proc.communicate()', '', '', 'def main():', ' startsofficeserver()', ' shutdownsoffieserver()', '', '', 'if __name__ == "__main__":', ' main()']
Neoformat: autopep8.exe --indent-size=2 --max-line-length=120 2> C:\Users\username\AppData\Local\Temp\neoformat\stderr.log
Neoformat: using stdin
Error detected while processing function neoformat#Neoformat[5]..<SNR>161_neoformat:
line 83:
E484: Can't open file <empty>
PS: I was able to execute the underyling command (autopep8 --indent-size=2 --max-line-length=120 <filename>) with no errors.
By any chance did you find a fix?
I'm getting this error too, but I'm using Linux. It took me a while to figure out I had to increase the verbosity to get the full message. Anyways, this is what I have:
Neoformat: ['# Read and write into terminal window', 'while True:', ' text = input(''basic > '')', ' print(text)'] Neoformat: autopep8 --indent-size=2 --max-line-length=120 Neoformat: using stdin Error detected while processing function neoformat#Neoformat[5]..<SNR>74_neoformat: line 83: E484: Can't open file
I noticed for my error I have <SNR>74_neoformat: which is different from yours. Is that something significant?
For now I think I'll try using a different formatter.
By any chance did you find a fix?
I'm getting this error too, but I'm using Linux. It took me a while to figure out I had to increase the verbosity to get the full message. Anyways, this is what I have:
Neoformat: ['# Read and write into terminal window', 'while True:', ' text = input(''basic > '')', ' print(text)'] Neoformat: autopep8 --indent-size=2 --max-line-length=120 Neoformat: using stdin Error detected while processing function neoformat#Neoformat[5]..<SNR>74_neoformat: line 83: E484: Can't open file
I noticed for my error I have
<SNR>74_neoformat:which is different from yours. Is that something significant?For now I think I'll try using a different formatter.
The <SNR>_74_neoformat is a way for vim-runtime to identify the function. This has no signifance what os ever, in this context.
I have moved on from the plugin. You may wan to look at:
Vim-AutoFormat might be easy to setup for quick switch relatively.