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

No APPDATA environment variable in Linux: expected str, bytes or os.PathLike object, not NoneType #220

Open
hfs opened this issue Mar 3, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@hfs
Copy link

hfs commented Mar 3, 2023

Trying to run

from pandasgui import show

on Ubuntu Linux fails with:

Traceback (most recent call last):
  File "/home/hfs/usr/bin/pandasgui-file", line 7, in <module>
    from pandasgui import show
  File "/opt/mambaforge/envs/pandasgui/lib/python3.11/site-packages/pandasgui/__init__.py", line 15, in <module>
    from pandasgui.gui import show
  File "/opt/mambaforge/envs/pandasgui/lib/python3.11/site-packages/pandasgui/gui.py", line 13, in <module>
    from pandasgui.constants import PANDASGUI_ICON_PATH
  File "/opt/mambaforge/envs/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

APPDATA is a Windows-specific environment variable.

As a workaround one can set the variable to a dummy value:

export APPDATA=

In general it would be nice if “adding to the start menu” was wrapped in some operating system detection, because it only makes sense on Windows anyway.

Environment
OS: Ubuntu 22.04.2 LTS
Python: Python 3.11.0

Package versions

ipython @ file:///home/conda/feedstock_root/build_artifacts/ipython_1677617093347/work
jupyter_core @ file:///home/conda/feedstock_root/build_artifacts/jupyter_core_1675109859355/work
pandasgui==0.2.14
plotly @ file:///home/conda/feedstock_root/build_artifacts/plotly_1677271849976/work
PyQt5==5.15.7
PyQt5-sip==12.11.0
PyQtWebEngine==5.15.6
PyQtWebEngine-Qt5==5.15.2
@hfs hfs added the bug Something isn't working label Mar 3, 2023
@bwhitby
Copy link

bwhitby commented Mar 3, 2023

I'm having a similar issue on my mac?

TypeError Traceback (most recent call last)
Input In [2], in <cell line: 2>()
----> 2 from pandasgui import show

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/site-packages/pandasgui/init.py:15, in
12 logger.addHandler(sh)
14 # Imports
---> 15 from pandasgui.gui import show
17 all = ["show", "version"]

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/site-packages/pandasgui/gui.py:13, in
10 from PyQt5.QtCore import Qt
12 import pandasgui
---> 13 from pandasgui.constants import PANDASGUI_ICON_PATH
14 from pandasgui.store import PandasGuiStore, SettingsSchema
15 from pandasgui.utility import as_dict, fix_ipython, get_figure_type, resize_widget

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/site-packages/pandasgui/constants.py:15, in
12 PANDASGUI_ICON_PATH = pkg_resources.resource_filename(name, "resources/images/icon.png")
13 PANDASGUI_ICON_PATH_ICO = pkg_resources.resource_filename(name, "resources/images/icon.ico")
---> 15 SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', )
16 PY_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'python.exe')
17 PYW_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/posixpath.py:76, in join(a, *p)
71 def join(a, *p):
72 """Join two or more pathname components, inserting '/' as needed.
73 If any component is an absolute path, all previous path components
74 will be discarded. An empty last part will result in a path that
75 ends with a separator."""
---> 76 a = os.fspath(a)
77 sep = _get_sep(a)
78 path = a

TypeError: expected str, bytes or os.PathLike object, not NoneType

@kusumy
Copy link

kusumy commented Mar 7, 2023

Where to execute "export APPDATA=" ?
I tried on Linux Terminal, but the error still persist

@CarelKattriggerise
Copy link

I just commended out the line
#SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', )
and that worked for me

@aarnipalli
Copy link

I just commended out the line #SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', ) and that worked for me

Where did you comment out the line?

@aarnipalli
Copy link

I'm having a similar issue on my mac?

TypeError Traceback (most recent call last) Input In [2], in <cell line: 2>() ----> 2 from pandasgui import show

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/site-packages/pandasgui/init.py:15, in 12 logger.addHandler(sh) 14 # Imports ---> 15 from pandasgui.gui import show 17 all = ["show", "version"]

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/site-packages/pandasgui/gui.py:13, in 10 from PyQt5.QtCore import Qt 12 import pandasgui ---> 13 from pandasgui.constants import PANDASGUI_ICON_PATH 14 from pandasgui.store import PandasGuiStore, SettingsSchema 15 from pandasgui.utility import as_dict, fix_ipython, get_figure_type, resize_widget

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/site-packages/pandasgui/constants.py:15, in 12 PANDASGUI_ICON_PATH = pkg_resources.resource_filename(name, "resources/images/icon.png") 13 PANDASGUI_ICON_PATH_ICO = pkg_resources.resource_filename(name, "resources/images/icon.ico") ---> 15 SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', ) 16 PY_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'python.exe') 17 PYW_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')

File ~/opt/anaconda3/envs/streamlit/lib/python3.8/posixpath.py:76, in join(a, *p) 71 def join(a, *p): 72 """Join two or more pathname components, inserting '/' as needed. 73 If any component is an absolute path, all previous path components 74 will be discarded. An empty last part will result in a path that 75 ends with a separator.""" ---> 76 a = os.fspath(a) 77 sep = _get_sep(a) 78 path = a

TypeError: expected str, bytes or os.PathLike object, not NoneType

having the same issue on my mac; can not find a solution

@minikiller
Copy link

I got same error on my mac.

@TsaiTung-Chen
Copy link

TsaiTung-Chen commented Mar 11, 2023

The PyPI version may be old.
Trying pip install git+https://github.com/adamerose/pandasgui.git solved the issue for me.

@500apes
Copy link

500apes commented Mar 20, 2023

Where to execute "export APPDATA=" ? I tried on Linux Terminal, but the error still persist

I put the following in my script:

import os
os.environ['APPDATA'] = ""

@Buedenbender
Copy link

Same issue for me on a debian based distribution. If possible I think it could be beneficial for the package to tackle this issue. Some possible new users might become disheartend by the error and dish this great package without ever using it.

Installing directly from git is sadly not always possible in an enterprise setting.
I circumvented the problem by adding the dummy export to my .bashrc file, which is execute on the start of a new terminal.
If you want to follow along:

  1. Use a text editor to open your .bashrc file (e.g., nano, vim, whatever)
nano ~/.bashrc
  1. Add export statement for the dummy enviroment variable to the end of the file
export APPDATA=
  1. Save and exit the text editor

This fixed the error. That being said, it does not work well in devcontainer at all, my next barrier would be

ImportError: this platform is not supported: ('failed to acquire X connection: Bad display name ""', DisplayNameError(''))

Try one of the following resolutions:

 * Please make sure that you have an X server running, and that the DISPLAY environment variable is set correctly

@jgcb00
Copy link

jgcb00 commented May 19, 2023

To solve the issue I did :

git clone https://github.com/adamerose/PandasGUI.git
cd PandasGUI
nano pandasgui/constants.py

Commented the 3 last line :

#SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', )
#PY_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'python.exe')
#PYW_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')

saved the file and :

pip install .

And it's now working (Ubuntu 22.04, python3.10)

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

10 participants