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

0.2.14 (the latest version on PyPi) cannot be imported without the APPDATA environment variable #255

Open
adamtuft opened this issue May 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@adamtuft
Copy link

Describe the bug

On linux:

pip install pandasgui
python -c "import pandasgui"

Output:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/adam/.venv/pandasgui/lib/python3.11/site-packages/pandasgui/__init__.py", line 15, in <module>
    from pandasgui.gui import show
  File "/home/adam/.venv/pandasgui/lib/python3.11/site-packages/pandasgui/gui.py", line 13, in <module>
    from pandasgui.constants import PANDASGUI_ICON_PATH
  File "/home/adam/.venv/pandasgui/lib/python3.11/site-packages/pandasgui/constants.py", line 15, in <module>
    SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', )
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 76, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

This works, however:

APPDATA="" python -c "import pandasgui"

The APPDATA environment variable is not one that is commonly set by default on Linux, which makes it awkward to import this package unless you know that it expects the variable to exist in the environment.

Environment
OS: 6.1.85-1-MANJARO GNU/Linux
Python: 3.11.8

Package versions

ipython==8.24.0
pandasgui==0.2.14
plotly==5.22.0
PyQt5==5.15.10
PyQt5-Qt5==5.15.2
PyQt5-sip==12.13.0
PyQtWebEngine==5.15.6
PyQtWebEngine-Qt5==5.15.2
@adamtuft adamtuft added the bug Something isn't working label May 17, 2024
@ger08061959
Copy link

The following code works (better):

import os
env = os.getenv('APPDATA')
if env is None:
os.environ["APPDATA"] = "."

instead of APPDATA="" python -c "import pandasgui" which only did run once.

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