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

Unable to log in using the webinterface when PiFinder is running on a local machine #253

Closed
WimDeMeester opened this issue Nov 5, 2024 · 6 comments

Comments

@WimDeMeester
Copy link
Contributor

When running the webinterface on my local machine (so not the PiFinder itself), I can not log in anymore... I get the error

Traceback (most recent call last):
  File "/home/wim/micromamba/envs/pifinder/lib/python3.9/site-packages/bottle.py", line 876, in _handle
    return route.call(args)
  File "/home/wim/micromamba/envs/pifinder/lib/python3.9/site-packages/bottle.py", line 1759, in wrapper
    rv = callback(*a, ka)
  File "/mnt/c/Users/u0035065/GitHub/PiFinder/python/PiFinder/server.py", line 149, in login
    if sys_utils.verify_password("pifinder", password):
  File "/mnt/c/Users/u0035065/GitHub/PiFinder/python/PiFinder/sys_utils.py", line 290, in verify_password
    """
NameError: name 'su' is not defined 

This can be fixed easily by adding the following 2 lines at line 290 of sys_utils.py:

    if not REAL_SYS_UTILS:
        return True

@jscheidtmann
Copy link
Contributor

Hi Wim, I am running into the same problem.

Well, there's been provisions for that: There once was a get_sys_utils()-function that imports sys_utils_fake.py, if su cannot be found. Someone seemed to be unware of this and instead catched the exception.

@mrosseel
Copy link
Collaborator

mrosseel commented Jan 24, 2025

Hi Wim, I am running into the same problem.

Well, there's been provisions for that: There once was a get_sys_utils()-function that imports sys_utils_fake.py, if su cannot be found. Someone seemed to be unware of this and instead catched the exception.

you are correct, the code is in utils.py and should be used to import sys_utils. Since you can reproduce the issue, could you create a PR removing the exception catching in sys_utils?

def get_sys_utils():
    try:
        # Attempt to import the real sys_utils
        sys_utils = importlib.import_module("PiFinder.sys_utils")
    except ImportError:
        sys_utils = importlib.import_module("PiFinder.sys_utils_fake")
    return sys_utils

@jscheidtmann
Copy link
Contributor

Can do.

@jscheidtmann
Copy link
Contributor

Hi Wim, can you check my PR #267 ?

@jscheidtmann
Copy link
Contributor

Fixed with #267. @brickbots can you close?

@brickbots
Copy link
Owner

Absolutely! Thank you @jscheidtmann 👍

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

No branches or pull requests

4 participants