0
I need to automatically get the address of the document folder of any Windows with Python.
Currently in my script determined as shown in the variable main_folder
, but whenever I change PC I have to change this address. Below is also one of the uses of this variable in my script.
Creating directories and subdirectories. If anyone knows any other method, I will be very grateful.
import arcpy
main_folder = r"C:\Users\Edeson Bizerril\Documents\myEBpy_Files"
# EXEMPLO DE USO
# Determinando diretório
input_folder = main_folder + "\Input\\"
input_folder_SRTM = self.input_folder + r"SRTMs\\"
create_folder(input_folder)
create_folder(input_folder_SRTM)
# Método para criação de diretórios
def create_folder(path):
if not os.path.isdir(path):
os.makedirs(path)
Unfortunately I need to determine the reference folder in my work, but I would like Python to automatically identify and return me exactly the same result in the variable main_folder
.
Dude, I couldn’t quite figure out what you want. It’s like putting an example of output or even a step by step with start, middle and end?
– Lorran Sutter
I work with Arcgis and python, so I need to inform arcgis the main work address. The way you were informed works, because I inform him by associating this variable. But whenever I change the pc I need to change the username. understand? But I’ll see if I can improve this question
– Edeson Bizerril