I'm having the same issue with my output file (a txt file in my case) getting outputted to the wrong folder in the directory path. I have tried to follow Matthew's solution above to incorporate the "/" after the GetParameter, but I end up with syntax errors. Could someone alter his code to show me where the "/" should be placed? Thanks.
Without seeing the code and error it's hard to say. Are you putting "/" for the rest of the path? If you use "\" you need to add the r at the beginning of the path."Y:/folder1/folder2/folder3/PARAMETER INPUT" or r"Y:\folder1\folder2\folder3\PARAMETER INPUT" . Is your output setting of the parameter a text?
It would be better to use the os.path.join to create the path to the output file.
Example:
import os my_folder = r"C:\aFolder\aSubFolder" my_filename = "someFileName.ext" print os.path.join(my_folder, my_filename)
... will yield this:
C:\aFolder\aSubFolder\someFileName.ext
And you can even do this:
import os my_folder = r"C:\aFolder\aSubFolder" my_filename = "someFileName.ext" print os.path.join(my_folder, "anotherSubFolder", my_filename)
... which will yield this:
C:\aFolder\aSubFolder\anotherSubFolder\someFileName.ext
Thank you Matthew and Xander.
Using the os.path.join worked like a charm.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.