Hello. I am trying to use the 'migrate_assignments' script to move assignment data from Classic Workforce projects to new Workforce projects in ArcGIS for Enterprise (10.8.1 with Workforce patch installed). I have already used the 'migrate' utility in the Workforce web app dashboard to create new Workforce projects from the classic ones. I am using ArcGIS Pro 2.7.0 which now has ArcGIS for Python 1.8.3. I am using the 'migrate assignment only' command prompt provided in a blog dated August 31, 2020 (Migrate a Classic Workforce project (esri.com).
From the blog: python migrate_assignments.py -u <username> -p <password> -org https://<org>.maps.arcgis.com -classic-project-id <project-item-id> -new-project-id <new-project-fs-item-id>
I am running the script from the python shell in Pro. Regardless of the command line settings, I receive a syntax error. I place double quotes around the parameters instead of the < >.
python drive:\folder\folder\migrate_assignments.py -u "username" -p "password" -org "https://webadaptor.cityofnewarkde.us/portal" -classic-project-id 5c792f3583e44a6b910076d0d7f04628 -new-project-id 766c82cff9464341850ce625c6e99a76
I could not find a way to download the script directly from GitHub. Rather, I had to copy the code and paste it into Notepad to create the migrate_assignments.py.
I have tried many iterations when it comes to placing the double quotes around the parameters. My lack of experience is evident here. The user has admin privileges.
I am at a loss as to why this script is not running, or as to what operator error is getting in the way. Any help would be appreciated.
Solved! Go to Solution.
Next issue with Migrating Classic Workforce project using these steps:
When I run this:
migrate_assignments.py -u <username> -p <password> -org https://<org>.maps.arcgis.com -classic-project-id <project-item-id> -new-project-id <new-project-fs-item-id>
it throws an error that there is invalid syntax on this line:
logger.info(f"Migrating attachments for assignment {i + 1}/{len(existing_assignments)} objectId: {object_id}")
Anybody know what this means and a viable solution?
My guess is you are running the script with the wrong python interpreter (e.g. Python 2 instead of Python 3). Make sure you run this in the command prompt/terminal first:
conda activate workforce-scripts
Then run:
python migrate_assignments.py ....
I finally got migrate_assignments.py to run. For anyone having to use migrate_assignments.py, Aaron's suggestion regarding changing last line in environment.yml to - pypng==0.0.21 from - pypng==0.0.18 was a critical point. Check this line to see if it needs fixing.
Since I'm using Windows 10, "conda" didn't work for me - so instead just typed "activate workforce-scripts" and that worked.
Also, I'm using ArcGIS Enterprise and had to add "portal" to my URL (see sample below comparing parameters to run code):
python migrate_assignments.py -u <username> -p <password> -org https://<org>.maps.arcgis.com
-classic-project-id <project-item-id> -new-project-id <new-project-fs-item-id>
SHOULD BE:
python migrate_assignments.py -u <username> -p <password> -org https://mygis.com/portal
-classic-project-id <project-item-id> -new-project-id <new-project-fs-item-id>