Ask coding questions

← Back to all posts
how to get directory path
TheBlockkingBlo

i am asking how to get the directory path because when i have this in my code 'os.chdir('mainprofile.json')' i get this error
'NotADirectoryError: [Errno 20] Not a directory: 'mainprofile.json''

Answered by GatewayDuckYT [earned 5 cycles]
View Answer
Voters
ArthurTam
TheBlockkingBlo
Comments
hotnewtop
GatewayDuckYT

The directory path would be
/home/runner/<project name>/<file path>
like
/home/runner/chat/assets/bob.png
Click the check if this helped
Need more help? just reply to this

GatewayDuckYT

@GatewayDuckYT in js i would do

TheBlockkingBlo

@GatewayDuckYT I'm using python (discord.py) should have said that sorry

GatewayDuckYT

@TheBlockkingBlo the paths would still be the same

TheBlockkingBlo

@GatewayDuckYT how would i add os.chdir() into this? (im kinda new with replit sorry)

TheBlockkingBlo

@GatewayDuckYT i still get the same error when i try this