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

Version 0.9.2 does not find px.ini in script folder #213

Open
nicerloop opened this issue Mar 20, 2024 · 5 comments
Open

Version 0.9.2 does not find px.ini in script folder #213

nicerloop opened this issue Mar 20, 2024 · 5 comments
Labels

Comments

@nicerloop
Copy link

nicerloop commented Mar 20, 2024

Hi,

I installed px using scoop. The script ends in $HOME\scoop\apps\px\current.
I installed px to run on login: $HOME\scoop\apps\px\current\pythonw.exe -m px --install
I configured px to use my upstream proxy.pac: px --pac=<proxy.pac.url> --save --config=$HOME\scoop\apps\px\current\px.ini
Upon re-relogin, px is started but does not use the configure upstream proxy.pac.

I tried to work around by:

  • explicitly declaring the config file location upon installation, but it is not carried over to the Run command
  • set the PX_CONFIG environment property, but it seems to not be set in the context of the Run command

Did I misundertood how this is supposed to work?

Thank you.

@genotrance
Copy link
Owner

Can you please confirm if px.ini does get updated in the script directory with your pac url?

On powershell, you need to change $HOME to $Env:USERPROFILE. On cmd, it would be %USERPROFILE%. I presume you have simply used $HOME as an example here but just in case.

@genotrance
Copy link
Owner

Never mind - this is broken when running Px in -m px mode. You will need to manually edit the Run command in the registry with the config path to get it working. I'm not sure what CWD is the default when it is run from the registry - could be $HOME but you will need to test it and then put a px.ini there alternatively.

@genotrance genotrance added the bug label Mar 21, 2024
@nicerloop
Copy link
Author

Can you please confirm if px.ini does get updated in the script directory with your pac url?

I confirm the explicitly targeted px.ini does get updated with the PAC URL.

On powershell, you need to change $HOME to $Env:USERPROFILE. On cmd, it would be %USERPROFILE%. I presume you have simply used $HOME as an example here but just in case.

I use powershell core, and the $HOME path does point to the same location as $ENV:USERPROFILE. This is not the source of my problem.

@nicerloop
Copy link
Author

Regarding the --install option and the Run registry command:

I'm not sure what CWD is the default when it is run from the registry - could be $HOME but you will need to test it and then put a px.ini there alternatively.

It seems the CWD is C:\Windows\System32 which is NOT a location I can put a user-scoped configuration file, even if I had the required rights.

Never mind - this is broken when running Px in -m px mode.

But px --help states that the px.ini config file default location is working directory or script directory.
I hoped this to find my px.ini configuration located in the install folder.
It seems from a cursory reading of the sources that it should find my px.ini next to pythonw.exe in the install folder.
But I am not a python developer.

You will need to manually edit the Run command in the registry with the config path to get it working.

I will try that.

@nicerloop
Copy link
Author

After configuring Px from the command line from the $HOME folder:

px --pac=<proxy.pac.url> --save

I manually set the Run registry key with the following PowerShell command:

Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -Name Px -Value "$HOME\scoop\apps\px\current\pythonw.exe -m px --config=$HOME\px.ini"

and Px correctly started on login without a window and with the upstream Proxy Auto-Configuration.

Could you fix:

  1. the px.ini discovery to correctly find it when located next to px.exe or pythonw
  2. the --install command to also set the --config parameter

The documentation should be updated to reflect the actual working installation for Windows.

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

No branches or pull requests

2 participants