Friday, 23 November 2018

Creating Attribute Rules using ArcPy in ArcGIS Pro


I am attempting to create attribute rules for a signalized intersection asset inventory, so when features are addded using collector they are automatically updated in the database. I am also working on using attribute assistants GENERATE ID BY INTERSECT so I can just append the updates via importing the changes from an online service into ArcMap. The reason for using Attribute Rules is for transitioning to an Enterprise Environment, with the plan for heavy ArcGIS Pro use. So I am trying to get ahead by getting my feet wet with the more development / programmable side of ArcGIS.


I am having trouble assigning the database sequence.


arcpy.management.CreateDatabaseSequence("J:\Network\Work Areas\Acheff\Traffic Asset Inventory\Traffic Assets\Traffic Assets\Traffic Assets.gdb", "tSignalPoles", "0001", "0001")




File "", line 1 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: malformed \N character escape




Answer




Some character sequences are treated in a special way. For instance \n is a newline and \t is a tab character.


The error message is about \N, which is an invalid escape sequence in the first place.


The easiest way to resolve this is by adding an r prefix to the string: r'J:\Network\etcetera\.... See here.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...