how to get full name path of selected file in browser ?

This is the place for queries about ThorPy issues : installation, coding, ...
buffalo
Posts: 44
Joined: Thu Feb 25, 2016 10:34 am

how to get full name path of selected file in browser ?

Postby buffalo » Sun Jun 18, 2017 8:58 pm

i get :
starting target file : ../
starting target file : <thorpy.elements.inserter.Inserter object at 0x7fbae8077dd8>

Code: Select all

print(" starting target file   : {}  ".format(browser.path))
print(" starting target file   : {}  ".format(browser._selected))

ThorPy
Site Admin
Posts: 21
Joined: Wed May 13, 2015 9:44 pm

Re: how to get full name path of selected file in browser ?

Postby ThorPy » Sun Jun 18, 2017 9:50 pm

Actually this is more a general problem of path handling. One should use the os.path module to play with relative/absolute paths.
You can do like this:

import os

os.path.abspath(browser.get_value()) #returns the absolute path of the selected file
os.path.abspath(browser.path) #returns the absolute path of the folder containing the selected file

Is it what you needed ?


Return to “General ThorPy help”

Who is online

Users browsing this forum: No registered users and 1 guest