Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use problem. help #17

Open
Gu-f opened this issue May 26, 2022 · 1 comment
Open

Use problem. help #17

Gu-f opened this issue May 26, 2022 · 1 comment

Comments

@Gu-f
Copy link

Gu-f commented May 26, 2022

usage: Pytago [-h] [-o OUTFILE] INFILE

pytago -o test.go test.py
It output an error when using the above command.

D:\PythonProject>pytago test.py  
Traceback (most recent call last):  
  File "D:\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main  
    return _run_code(code, main_globals, None,  
  File "D:\Python\Python310\lib\runpy.py", line 86, in _run_code  
    exec(code, run_globals)  
  File "D:\Python\Python310\Scripts\pytago.exe\__main__.py", line 7, in <module>  
  File "D:\Python\Python310\lib\site-packages\pytago\cmd.py", line 14, in main  
    go = python_to_go(f.read(), debug=False)  
  File "D:\Python\Python310\lib\site-packages\pytago\core.py", line 31, in python_to_go  
    return go_ast.unparse(go_tree, debug=debug)  
  File "D:\Python\Python310\lib\site-packages\pytago\go_ast\parsing.py", line 55, in unparse  
    externally_formatted_code = _golines(_gofumpt(_goimport(code)))  
  File "D:\Python\Python310\lib\site-packages\pytago\go_ast\parsing.py", line 251, in _goimport  
    p = Popen(["goimports"], stdout=PIPE, stderr=PIPE, stdin=PIPE)  
  File "D:\Python\Python310\lib\subprocess.py", line 966, in __init__  
    self._execute_child(args, executable, preexec_fn, close_fds,  
  File "D:\Python\Python310\lib\subprocess.py", line 1435, in _execute_child  
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,  
FileNotFoundError: [WinError 2]

It looks like it didn't find the file, but it does exist

@endmarsfr
Copy link

Hi,
It's because goimports is not found. (maybe not in path) p = Popen(["goimports"], stdout=PIPE, stderr=PIPE, stdin=PIPE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants