Closed hefengxian closed 4 years ago
Regarding formatting, thanks for pointing to such an issue. I thought that my editor will do that by default. However, I realized that I need to configure it, first, to do so. I did a little research about this, I found
black
,yapf
andpep8
to be the most popular formatters. What your preferred one? For me, I think I will adopt yapf. It is driving more attention recently. By the way, I should also add a badge for the coding format style I will follow to README just for the sake of elaboration.
I'm using PyCharm IDE to format code, this is very good tool to develop Python applications, they are also free version PyCharm Community.
I think Google code style almost same with PEP8, and i prefer PEP8
Thanks for your work @hefengxian, I will try to merge and update tonight.
hey @hefengxian, I am really sorry. I run into some issues these two days. I was unable to find a suitable time to search and think about the issue of tempfile. I hope I will be able to do so tomorrow and close this pull request.
@hefengxian I tested the changes on my machine and merged the pull request. Thanks for your effort, really appreciate it. Looking forward to your collaborations and helpful comments.
Not compatible with Windows OS
Thank you for your hard work on this lib.
Issues
But i find out on Windows platform there are several issues
shlex.split()
can't process directory saparator\
Interactive
mode it's can't get right encoding from CMD outputStandalone
, Python APItempfile.NamedTemporaryFile
can not write content in tmp directory even withtmpfile.flush()
is calledSo, i do some test about above issues
about shlex.split()
file
issue_test.py
underE:\workspace\python\farasapy\
run result
after called
shlex.split()
character\
was missing in result['java', '-jar', 'E:workspacepythonfarasapy/xxx.jar']
about mode 「interactive」
when run interactive mode will show these error
about mode 「standalone」
run
tests.py
under project farasapy, will give error like thisno useful information, so i change the code about function
_run_task()
add line
print(proc.stdout, proc.stderr)
, then i get errors from Javait's cannot find tempfile, so i check Python docs https://docs.python.org/3/library/tempfile.html, on Windows there is problem with not have param
delete=False
intempfile.NamedTemporaryFile()
Solution
i will submit a PR
about shlex.split() & mode 「interactive」
shlex.split()
tolist()
-Dfile.encoding=UTF-8
about mode 「standalone」
we set
tempfile.NamedTemporaryFile(dir='...', delete=False)
other
code style not good, reformat core code http://google.github.io/styleguide/pyguide.html
test
i test the code after change on Windows 10 & macOS Catalina, it's passed