mcahn
May 21, 2026, 3:21am
1
I’ve copied a project to a new location. This command used to work:
cryosparcm cli "update_project_directory('Pxxx', '/new/project/path')"
but is now giving me…
NameError: name 'update_project_directory' is not defined
I presume this is a version 4 vs 5 problem. What is the version 5 equivalent?
Thanks,
Matthew
Hi Matthew, we’ve removed official support for changing a project directory like this in v5, the next time you have to do this, I recommend using Archive/Unarchive operations , for added safety.
As a workaround to resolve this, you can use the following command:
cryosparcm cli 'db.projects.update_one({"uid": "Pxxx"}, {"$set": {"project_dir": "/new/project/path"}}).modified_count'
Edit: If you prefer to use command-line over the Archive/Unarchive functions in the UI, you can do this:
cryosparcm cli 'api.projects.archive("Pxx")'
mv /old/project/path /new/project/path # move the project
cryosparcm cli 'api.projects.unarchive("Pxx", path="/new/project/path")'
mcahn
June 2, 2026, 9:10pm
3
Thanks nfrasser.
I did this:
cryosparcm cli 'db.projects.update_one({"uid:": "P566"}, {"$set": {"project_dir": "/new/project/path"}}).modified_count'
It returned 0 and the directory shown in the UI is still the old one. I wonder if “uid” is the right thing to search on.
Hi @mcahn , are you sure you selected the right project UID? Could you show me the output of these commands?
cryosparcm cli 'api.projects.find_one("P566").project_dir'
cryosparcm cli 'db.projects.update_one({"uid:": "P566"}, {"$set": {"project_dir": "/new/project/path"}}).matched_count'
cryosparcm cli 'api.projects.find_one("P566").project_dir'
If you see
Response data:
{
"detail": "Project P566 not found"
}
This means the project is not available in the instance you are connecting to.
mcahn
June 3, 2026, 4:46pm
5
Hi @nfrasser ,
Yes, I’m sure it’s P566. Here are the results of those commands…
$ cryosparcm cli 'api.projects.find_one("P566").project_dir'
/scratch/gpfs/CRYOEM/jimahlab/ar5531/CS-pfdyn3-k71a-r256k-cl-dops
$ cryosparcm cli 'db.projects.update_one({"uid:": "P566"}, {"$set": {"project_dir": "/projects/JIMAH/ar5531/CS-pfdyn3-k71a-r256k-cl-dops"}}).matched_count'
0
$ cryosparcm cli 'api.projects.find_one("P566").project_dir'
/scratch/gpfs/CRYOEM/jimahlab/ar5531/CS-pfdyn3-k71a-r256k-cl-dops
It seems that find_one can find the project, but update_one can’t find the project.
Ah I didn’t notice the typo in the filter: it should be uid, not uid: (extra colon in the string). Try this:
cryosparcm cli 'db.projects.update_one({"uid": "P566"}, {"$set": {"project_dir": "/projects/JIMAH/ar5531/CS-pfdyn3-k71a-r256k-cl-dops"}}).matched_count'
mcahn
June 3, 2026, 9:32pm
7
Thanks very much, sorry I didn’t catch that. Works now…
$ cryosparcm cli 'db.projects.update_one({"uid": "P566"}, {"$set": {"project_dir":"/projects/JIMAH/ar5531/CS-pfdyn3-k71a-r256k-cl-dops"}}).matched_count'
1
$ cryosparcm cli 'api.projects.find_one("P566").project_dir'
/projects/JIMAH/ar5531/CS-pfdyn3-k71a-r256k-cl-dops
1 Like