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

can even import the package successfully on windows #146

Open
sinceronny opened this issue Apr 18, 2023 · 2 comments
Open

can even import the package successfully on windows #146

sinceronny opened this issue Apr 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@sinceronny
Copy link

sinceronny commented Apr 18, 2023

Describe the bug

can't event import your python package successfully

from prismacloud.api import pc_api

Expected behavior

should import your package successfully

Current behavior

Traceback (most recent call last):
File "c:\code\pl-docker-infrastructure\production\aws\PrismaAutomation\PrismaTest.py", line 2, in
from prismacloud.api import pc_api
File "C:\code\pl-docker-infrastructure.venv\lib\site-packages\prismacloud\api_init_.py", line 5, in
from .pc_lib_api import PrismaCloudAPI
File "C:\code\pl-docker-infrastructure.venv\lib\site-packages\prismacloud\api\pc_lib_api.py", line 9, in
from .pc_lib_utility import PrismaCloudUtility
File "C:\code\pl-docker-infrastructure.venv\lib\site-packages\prismacloud\api\pc_lib_utility.py", line 26, in
class PrismaCloudUtility():
File "C:\code\pl-docker-infrastructure.venv\lib\site-packages\prismacloud\api\pc_lib_utility.py", line 29, in PrismaCloudUtility
CONFIG_DIRECTORY = os.path.join(os.environ['HOME'], '.prismacloud')
File "C:\Program Files\Python39\lib\os.py", line 679, in getitem
raise KeyError(key) from None
KeyError: 'HOME'

Possible solution

Steps to reproduce

  1. create a python file
  2. import your package from prismacloud.api import pc_api
  3. run the script

Screenshots

Context

Your Environment

  • Version used:
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3):
  • Operating System and version (desktop or mobile):
  • Link to your project:
@sinceronny sinceronny added the bug Something isn't working label Apr 18, 2023
@welcome-to-palo-alto-networks

🎉 Thanks for opening your first issue here! Welcome to the community!

@tkishel
Copy link
Contributor

tkishel commented Apr 20, 2023

This mifght be solved via one of these answers:

https://stackoverflow.com/questions/14742064/python-os-environhome-works-on-idle-but-not-in-a-script

Replace os.environ['HOME'] with os.path.expanduser('~')

Or set HOME=%USERPROFILE%

Feel free to submit a PR for the former, and note that this SDK has not been developed or tested on Windows.

@deese deese mentioned this issue Sep 28, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants