proxy.py icon indicating copy to clipboard operation
proxy.py copied to clipboard

RuntimeWarning: `proxy.common.pki` found in sys.modules after import of package `proxy.common`

Open flareglare opened this issue 4 years ago • 3 comments

Describe the bug When attempting to make ca-certificates or make https-certificates console is flooded with RuntimeWarnings. This happens cloned version from GitHub.

To Reproduce Steps to reproduce the behavior:

  1. Clone from GitHub
  2. Create a virtualenv and install requirements.txt
  3. Run make ca-certificates
  4. See RuntimeWarning multiple times
(proxy.py--OOQT5gg) pop@pop-os:~/gits/proxy.py$ make ca-certificates 
# Generate CA key
python -m proxy.common.pki gen_private_key \
	--private-key-path ca-key.pem
/usr/lib/python3.8/runpy.py:127: RuntimeWarning: 'proxy.common.pki' found in sys.modules after import of package 'proxy.common', but prior to execution of 'proxy.common.pki'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
python -m proxy.common.pki remove_passphrase \
	--private-key-path ca-key.pem
/usr/lib/python3.8/runpy.py:127: RuntimeWarning: 'proxy.common.pki' found in sys.modules after import of package 'proxy.common', but prior to execution of 'proxy.common.pki'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
# Generate CA certificate
python -m proxy.common.pki gen_public_key \
	--private-key-path ca-key.pem \
	--public-key-path ca-cert.pem
/usr/lib/python3.8/runpy.py:127: RuntimeWarning: 'proxy.common.pki' found in sys.modules after import of package 'proxy.common', but prior to execution of 'proxy.common.pki'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
# Generate key that will be used to generate domain certificates on the fly
# Generated certificates are then signed with CA certificate / key generated above
python -m proxy.common.pki gen_private_key \
	--private-key-path ca-signing-key.pem
/usr/lib/python3.8/runpy.py:127: RuntimeWarning: 'proxy.common.pki' found in sys.modules after import of package 'proxy.common', but prior to execution of 'proxy.common.pki'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
python -m proxy.common.pki remove_passphrase \
	--private-key-path ca-signing-key.pem
/usr/lib/python3.8/runpy.py:127: RuntimeWarning: 'proxy.common.pki' found in sys.modules after import of package 'proxy.common', but prior to execution of 'proxy.common.pki'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))

Expected behavior I want to generate certificates without these warnings.

Version information

  • OS: Pop!_OS 20.10
  • proxy.py Version 2.3.0
  • Python: 3.8.6

flareglare avatar Nov 14 '20 11:11 flareglare

Thank you @kazik56 for reporting this. Does these warnings result in any unexpected behavior? If not, I will safely ignore them for now. Unfortunately, I don't have access to Pop!_OS and I wasn't able to reproduce / replicate these warnings on Mac and Linux OS. If no functionality is impacted, I'll label this issue as an enhancement and circle back to it in future.

abhinavsingh avatar Nov 16 '20 07:11 abhinavsingh

No. After inspecting one more time certificates files are visible in the cloned directory. This was just something I wanted to point out as I felt that it might not be a desired behavior.

I have one more question - the Makefile uses python instead of python3 - should I solve this by making an alias or replacing all python occurrences with python3?

flareglare avatar Nov 16 '20 22:11 flareglare

It's better to ensure python3 is default in the environment instead of changing all 'python' with 'python3'. Example if you are using virtualenv, this will automatically be the case.

On Tue, Nov 17, 2020, 3:43 AM kazik56 [email protected] wrote:

No. After inspecting one more time certificates files are visible in the cloned directory. This was just something I wanted to point out as I felt that it might not be a desired behavior.

I have one more question - the Makefile uses python instead of python3 - should I solve this by making an alias or replacing all python occurrences with python3?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/abhinavsingh/proxy.py/issues/459#issuecomment-728361323, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA6Y4OZCILU4R6KTZIQ573SQGPWZANCNFSM4TVPQAWA .

abhinavsingh avatar Nov 17 '20 06:11 abhinavsingh