Enable the use of Python f-strings to assemble paths to data sources.
Currently if I use Python f-strings to assemble paths to data sources, the GP Tool runs fine, but when publishing this GP tool through Share as WebTool, the Analyze process will trow en error:
00068: Result <value> contains broken project data source: <value>
folder = "c:/temp"
fdgb = "test.gdb"
fc_name = "my_example"
ds = f"{folder}/{fgdb}/{fc_name}"
if arcpy.Exists(ds):
arcpy.management.Delete(ds)
Currently, as suggested in Article ID: 000022882, a work-around could be to replace the / in the string literal with ? and then use .replace('?',"/)" to fool the Analyze process.
Instead of relying on this work-around, it would be much cleaner to have the f-strings properly supported when using the Share As WebTool, as they are the preferred way of string formatting in current Python 3.x versions
This was more of a defect, so I am closing it as such. Pro 3.5 has improved parsing of Python scripts for swizzling data path strings. The f string pattern shown above will no longer raise an error. The folder variable will be updated by the consolidation swizzling, and the full contents of the c:\temp directory would be uploaded to the server during publishing of the web tool.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.