Forum

Author Topic: Python document save command  (Read 7200 times)

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Python document save command
« on: January 13, 2016, 01:41:18 PM »
Hello,

I am running the Linux version in VirtualBox with a Windows host and I have a misbehavior with the Python Document.save function on 1.2.2 (not present in 1.1).

For the purpose of the test I only load images from a VirtualBox shared folder (so images are located on the Windows host) and try to save the project through the console pane.

I can save a project a but then PhotoScan displays the project as "Untitled*" and I have to reload the project otherwise it alerts me that some modifications are not saved when I try to close the software. Then, after every saved modification, I have the same behavior.
Code: [Select]
>>> doc.save('/media/sf_share/PS_tests/test_save.psx', chunks = doc.chunks)
True
2016-01-13 11:18:01 Saving project...
2016-01-13 11:18:01 saved project in 0.033142 sec
2016-01-13 11:18:01 Finished processing in 0.035386 sec (exit code 1)

>>> doc.save('/media/sf_share/PS_tests/test_save.psz', chunks = doc.chunks)
True
2016-01-13 11:18:23 Saving project...
2016-01-13 11:18:23 saved project in 0.241083 sec
2016-01-13 11:18:23 Finished processing in 0.244619 sec (exit code 1)

Also, is it intended that the save function does not work with relative path anymore?
« Last Edit: January 13, 2016, 01:59:26 PM by Gall »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Python document save command
« Reply #1 on: January 18, 2016, 12:22:56 PM »
Hello Gall,

Are the projects saved successfully, if you use GUI options?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Python document save command
« Reply #2 on: January 18, 2016, 12:54:07 PM »
When I use the GUI, saving works fine. I tried running a full project by changing the saving step by "save then reload" and the save files only contain masks and thumbnails folder so I'm not sure if the save command works besides the initial project file creation.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Python document save command
« Reply #3 on: January 18, 2016, 01:01:22 PM »
Hello Gall,

Could you please confirm that saving the processed project to the different location (that actually works as "Save as" operation) with it reopenning doesn't display any processed data (like point cloud, mesh and etc)?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Python document save command
« Reply #4 on: January 18, 2016, 01:44:34 PM »
Nevermind, the project is correctly saved. I was forgetting to refresh the chunk variable when reloading so I was always saving the initial state of the chunk...

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Python document save command
« Reply #5 on: January 20, 2016, 06:03:00 PM »
The unsaved state bug is still present in version 1.2.3.

Also, I was checking saving with relative path and notice an odd behavior.
Code: [Select]
2016-01-20 15:57:22 Saving project...
>>> doc.save('test_save_2.psx', chunks = doc.chunks)
False

2016-01-20 15:57:22 Finished processing in 0.104419 sec (exit code 0)
2016-01-20 15:57:22 Error: Can't save project
2016-01-20 15:57:32 Saving project...
2016-01-20 15:57:32 saved project in 0.155889 sec
>>> doc.save('./test_save_2.psx', chunks = doc.chunks)
True

2016-01-20 15:57:32 Finished processing in 0.156077 sec (exit code 1)
2016-01-20 15:58:24 Saving project...
2016-01-20 15:58:24 saved project in 0.142097 sec
>>> doc.save('test_save_2.psx', chunks = doc.chunks)
True

2016-01-20 15:58:24 Finished processing in 0.142322 sec (exit code 1)
2016-01-20 15:58:35 Saving project...
>>> doc.save('test_save_3.psx', chunks = doc.chunks)
False

2016-01-20 15:58:35 Finished processing in 0.000485 sec (exit code 0)
2016-01-20 15:58:35 Error: Can't save project

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Python document save command
« Reply #6 on: January 20, 2016, 06:57:27 PM »
Hello Gall,

When you are using relative path for document save operation from previously unsaved project, the default path is some system path (not sure about the specific one in case of the VirtualBox), so probably administrator rights are required to save to that folder and save process fails.

Also doc.save() for previously unsaved projects works as Save As operation. So new file is created under the input path, while the active document still remains unsaved. So you need to reopen the project after saving operation, or perform it in the very beginning of the script and then use doc.save() without any path argument.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Python document save command
« Reply #7 on: January 20, 2016, 07:02:39 PM »
I see. For the relative path, I use Python function os.chdir() to change working directory. It seems it was working in 1.1.6.

Glad you explained more in detail the doc.save() operation although this is not specified in the doc.