Can someone provide a link or the details regarding ArcGIS Project (*.aprx) naming conventions and file path restrictions? i.e. Is it restricted to alphanumeric and a selection of characters (I know underscores are fine if not encouraged)? Character limits?
Thank you in advance!
Solved! Go to Solution.
Can't find this in Pro's documentation any more, but it applies.
Then there are a whole load of Wikipedia articles which have links to various Windows documentation plus those of other operating systems
It is an iffy topic since there are rules and "rules" and it is complicated sometimes by how you intend to access filenames and their paths. For instance the use of "\" to denote an escape character which causes issues. See this blog for some issues.
The "recommendations" are not to use punctuation, spaces and characters other than letters and numbers.
Further recommendations might include not starting a folder with a number. The length of the path would be limited by the operating system accessing it (if memory serves)
More to the point... What type of paths do you want to create? Providing guidance as to whether they are a good idea might be useful
Thanks for your prompt response. My question was specifically on ArcGIS Pro Project *aprx file naming restrictions, and whether there is anything specific to APRX files or if they follow Python limits.
For example I had a 140-character count APRX project name that wasn't accepted, so reduced it to 120 characters and it was fine. From what you shared above, can you confirm the restriction was due possibly to the Windows default 260 character MAX, and not to the character limit of the ARPRX Project name?
My question would be what was in the 20 characters you trimmed?
Python naming convention for sure. If you are accessing paths through anything, they should be python compliant for the most part... (ie raw encoding... r"c:\a\b\r\t\x\" would fail on multiple conditions... see the blog)
Why such a long path name in the first place would be my second question if you are the only one having to use the paths.
An example path you use might be useful
It was just the Latin name of a fish species with nothing but underscores and alpha characters, literally just '_Salvenlinus_alpinus_'. No python filepath restrictions were violated. This is why I wondered if there was a ArcGIS Pro project name character limit.
Oh, and the reason for the long name is that it ideally matches a metadata record name which is necessarily long and descriptive as many of these data sources come from published scientific journal articles which are by necessity often very detailed.
If it was a filename '_Salvenlinus_alpinus_'
You could drop the pre and post underscores ( _ ) just to be on the safe side. Not exactly sure whether _ "could" be the first character in a filename (not the path), since I wouldn't use it in the first place but if needed
import os.path as op
p = "c:\Temp\_Salvenlinus_alpinus_.txt"
not sure for geodatabase featureclasses though
I appreciate the help, but this is just a substring in the middle of a filename. The filename has only alpha characters and underscores. The only thing that changed from Pro accepting the name and not was the length of the name. So I was wondering if there was a filename character length restriction for *.aprx files. But from what you've shared this doesn't seem to be the case.
Thanks for your help though!