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

Generate-config.py fails with FileNotFoundError #11

Open
m3ph1 opened this issue Jan 30, 2022 · 3 comments
Open

Generate-config.py fails with FileNotFoundError #11

m3ph1 opened this issue Jan 30, 2022 · 3 comments

Comments

@m3ph1
Copy link

m3ph1 commented Jan 30, 2022

I grabbed pia-wg today and installed python 3.10.2 and follow ed the readme.

Generate-config.py fails with "FileNotFoundError: [WinError 2] The system cannot find the file specified" and i have no idea why.

Here's my whole console output:

(venv2) D:\pia-wg-master\pia-wg-master>generate-config.py
Traceback (most recent call last):
File "D:\pia-wg-master\pia-wg-master\generate-config.py", line 9, in
pia.generate_keys()
File "D:\pia-wg-master\pia-wg-master\piawg.py", line 54, in generate_keys
self.privatekey = subprocess.run(['wg', 'genkey'], stdout=subprocess.PIPE, encoding="utf-8").stdout.strip()
File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@RoggerTan
Copy link

Did you forget to install Wireguard? It seems like the "wg genkey" command couldn't be executed.

@ptooey
Copy link

ptooey commented Feb 16, 2022

FYI I dealt with the same issue, where wg wouldn't execute from CLI (PowerShell/cmd).

Looks to me like the WireGuard install path is appended to the System PATH environment variable, and only works if you run CLI in Administrator mode.

The more obvious indicator of failure is when a Console window pops up blank and closes after the final step generate-config.py is executed.

When run in Administrator mode, the Console window actually prompts you to select which VPN Server location you want to generate settings for and successfully generates a file after closing, instead of appearing blank then closing.

@d-rez
Copy link

d-rez commented Jul 31, 2022

Looks like WireGuard installer didn't add itself to PATH, so the solution to this is to run the following right before executing generate-config.py:

set PATH=%PATH%;C:\Program Files\WireGuard

(Assuming you installed WireGuard to the above path). It will execute fine then.

@YidirK YidirK mentioned this issue Mar 30, 2024
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

4 participants