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

[Errno 2] No such file or directory #3

Open
joelbduncan opened this issue Dec 3, 2018 · 7 comments
Open

[Errno 2] No such file or directory #3

joelbduncan opened this issue Dec 3, 2018 · 7 comments

Comments

@joelbduncan
Copy link

Hey!

This looks pretty awesome will solve a issue I've been having with a app.

I'm having trouble with your example, I get this error after entering my password:
/usr/bin/python: can't open file 'test2.py': [Errno 2] No such file or directory

Wondered if you had any ideas?

I'm using Fedora 29 if that helps.

Thanks!

@catb0t
Copy link

catb0t commented Dec 3, 2018

Can you show your code?

@joelbduncan
Copy link
Author

Sure I'm using the example:

import os
from elevate import elevate

def is_root():
    return os.getuid() == 0

print("before ", is_root())
elevate()
print("after ", is_root())

I've found part of the answer if I run it using the full path:
python /home/joel/test2.py

It works, is this a requirement?

@catb0t
Copy link

catb0t commented Dec 4, 2018

Ah, I think that's a bug, let me see if I can write a fix.

catb0t added a commit to catb0t/elevate that referenced this issue Dec 8, 2018
@derVedro
Copy link

can you update the code for PyPi so no one ever run into that problem installing elevate with pip?

@catb0t
Copy link

catb0t commented Jun 18, 2019

@derVedro that pull which fixes this (#4) hasn't been merged yet, and unfortunately isn't released yet. You can clone my branch with the fix for now though.

catb0t added a commit to catb0t/elevate that referenced this issue Jun 18, 2019
- close barneygale#3: relative path expansion
- **temporarily** fix barneygale#5 for windows
- documentation is added to the workarounds
    in elevate_util

This implementation uses an import hook, which
    may not be the cleanest solution possible.

The import hook fixes argparse and similar modules
    seeing and complaining about --_with-elevate-*
    options, if the argument parser is called before
    the re-entrant call to elevate().
catb0t added a commit to catb0t/elevate that referenced this issue Jun 18, 2019
- close barneygale#3: relative path expansion
- **temporarily** fix barneygale#5 for windows
- documentation is added to the workarounds
    in elevate_util

This implementation uses an import hook, which
    may not be the cleanest solution possible.

The import hook fixes argparse and similar modules
    seeing and complaining about --_with-elevate-*
    options, if the argument parser is called before
    the re-entrant call to elevate().
@aki21j
Copy link

aki21j commented Mar 31, 2021

@catb0t I think this never was released on PyPi. Should I continue using your branch for this fix or will it be released

@catb0t
Copy link

catb0t commented Apr 12, 2021

@catb0t I think this never was released on PyPi. Should I continue using your branch for this fix or will it be released

See the discussion between Barney and I in #4. His equivalent, but better version of my branch is on the cwd_and_abs_paths branch of this repository, I suggest you clone and use that one, because it will (probably) be merged into master here eventually.

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

Successfully merging a pull request may close this issue.

4 participants