I am specifying a relative file path using jacaro's path module.
How can I get the absolute path from this variable as a string?
import path # From
path = path.path('~/folder/')
relative_filename = path.joinpath('foo')
# how can I get the absolute path of as a string?
absolute_path = ???
fd = open(absolute_path) 3 1 Answer
filename has a method called abspath that returns an object with the absolute path. You can cast that to a string.
...
folder_path = path('~/folder/')
filename = path.joinpath('foo')
f = sftp.open(str(filename), 'r') 2