elevate icon indicating copy to clipboard operation
elevate copied to clipboard

[Errno 2] No such file or directory

Open joelbduncan opened this issue 5 years ago • 7 comments

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!

joelbduncan avatar Dec 03 '18 15:12 joelbduncan

Can you show your code?

catb0t avatar Dec 03 '18 17:12 catb0t

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?

joelbduncan avatar Dec 04 '18 10:12 joelbduncan

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

catb0t avatar Dec 04 '18 17:12 catb0t

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

derVedro avatar Jun 18 '19 17:06 derVedro

@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 avatar Jun 18 '19 19:06 catb0t

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

aki21j avatar Mar 31 '21 18:03 aki21j

@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.

catb0t avatar Apr 12 '21 01:04 catb0t