onlyfans-dl icon indicating copy to clipboard operation
onlyfans-dl copied to clipboard

No such file or directory: 'auth.json'

Open BeachNL opened this issue 2 years ago • 1 comments

~ I AM THE GREAT KORNHOLIO ~
~  ARE U THREATENING ME??  ~
~                          ~
~    COOMERS GUNNA COOM    ~
~    HACKERS GUNNA HACK    ~

Traceback (most recent call last): File "D:\Downloads\Tools\onlyfans-dl\onlyfans-dl.py", line 345, in API_HEADER = create_auth() File "D:\Downloads\Tools\onlyfans-dl\onlyfans-dl.py", line 50, in create_auth with open("auth.json") as f: FileNotFoundError: [Errno 2] No such file or directory: 'auth.json' PS C:\Users\Beachy> cd D:\Downloads\Tools\onlyfans-dl PS D:\Downloads\Tools\onlyfans-dl> python D:\Downloads\Tools\onlyfans-dl\onlyfans-dl.py bratprincessava

BeachNL avatar Feb 06 '22 07:02 BeachNL

Did you download the entire repo? You have to have the auth.json file created and filled with the correct variables for the script to work

CoinSearchr avatar Jul 18 '22 23:07 CoinSearchr

I have this same issue running it as a cron job. It was copied in full from my machine (working) to the server. The files and directories are there the same as the repo. I get the below:

~ I AM THE GREAT KORNHOLIO ~
~  ARE U THREATENING ME??  ~
~                          ~
~    COOMERS GUNNA COOM    ~
~    HACKERS GUNNA HACK    ~

Traceback (most recent call last): File "./onlyfans-dl.py", line 354, in API_HEADER = create_auth() File "./onlyfans-dl.py", line 50, in create_auth with open("auth.json") as f: FileNotFoundError: [Errno 2] No such file or directory: 'auth.json'

EDIT: I've noted that when SSHing into the ubuntu device and running the script works with no issues. It's only when running it as a cron job that is has the issue. I ran the same command that has been entered into the Crontab so isn't a spelling or directory issue. Could this be something else maybe? I see this issue has been ongoing since Feb 2022. Is there any change of a response in regards to this as looks like a few people are having this issue...

KharonStyx avatar Mar 05 '23 15:03 KharonStyx

cron is a different environment in many ways from a login shell, so it's not terribly surprising that it works in a login shell and not from cron. I'd suggest adding print('cwd:', os.getcwd(), file=sys.stderr) before line 50 (before the with open("auth.json") as f: line). That should tell you the current directory, which is where the script is looking for auth.json. Move or copy auth.json there.

Alternately, add a os.chdir('<path>') near the top of the script (like after line 20), where <path> is where you want it to find auth.json and to save anything it downloads.

Another possibility would be to add cd '<path>'; before the command in your crontab file. cron will still need to find the script though, so you may need to add the full path to the script as well.

blmatthews avatar Mar 11 '23 22:03 blmatthews

The cd '<path>'; ./onlyfans-dl.py all worked. The others never changed the outcome of the error above, But at least we have a workaround for now.

Thank you @blmatthews Hopefully an easier fix can be implemented into the script itself.

KharonStyx avatar Mar 11 '23 22:03 KharonStyx