Skip to content
Advertisement

Tag: filepath

Accessing script file location from an external file python

I have the following bizarre set up. Consider 3 scripts in different directories: root1/folderA/scriptA.py root2/folderB/scriptB.py root2/folderC/scriptC.py The first file and it’s location are fully modifiable. The second and third are completely fixed. scriptA.py contains a parent class: scriptB.py contains a child class: scriptC.py contains the code to execute: In scriptC.py what I want is the behaviour to get the path

absolute path for file not working properly python

basically, I’m trying to store the full path for a file in a list but for some reason os.path.abspath() doesnt seem to work properly but my output seems to output this : ‘C:Users******Documentsfolderexample’ the problem is that it should be : ‘C:Users******DocumentsfolderTRACKERexample’ the difference is that the second one (the correct one) has the TRACKER included which is the official

Python get filepath

I’m trying to create a simple script to copy the filepath of a selected file (in windows explorer) to the clipboard in python. I’ve been looking at pyperclip and tkinter but I’m unsure how exactly to proceed. The askopenfilename in tkinter seems promising, but I’d like to select the files outside python and then call the script through the windows

Python string format

I have defined the string variable I need to use this variable in another string like I tried adding the rf option like this But it’s printing only until c:/program, white spaces are neglected. Is there any way to use entire path in Bashcmd and can’t remove spaces in directory path because many system share same paths. Answer You can

Advertisement