Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: SimonBrown on April 13, 2017, 08:01:55 PM

Title: Newbie - error running a script.
Post by: SimonBrown on April 13, 2017, 08:01:55 PM
Having recently upgraded to 1.3.1.4 I now find the following script:-

http://wiki.agisoft.com/w/index.php?title=Split_in_chunks.py&oldid=207 (http://wiki.agisoft.com/w/index.php?title=Split_in_chunks.py&oldid=207)

This script is really, really useful. Its a godsend for larger models such as this one:-

https://sketchfab.com/models/99d9f126ea0647f79e761d3cd2c1fca0 (https://sketchfab.com/models/99d9f126ea0647f79e761d3cd2c1fca0)

Created over 6 or 7 dives and now has nearly 10k images.

However, running the script triggers the following errors in the console:-

2017-04-13 17:47:31     class SplitDlg(QtWidgets.QDialog):
2017-04-13 17:47:31 NameError: name 'QtWidgets' is not defined

Can anyone suggest a fix for this one? its making me tear my hair out!
Title: Re: Newbie - error running a script.
Post by: Alexey Pasumansky on April 16, 2017, 04:10:18 PM
Hello SimonBrown,

That's very strange. Are you sure you've copied the full script including the following line:

Code: [Select]
from PySide2 import QtGui, QtCore, QtWidgets
Title: Re: Newbie - error running a script.
Post by: SimonBrown on April 22, 2017, 09:32:43 PM
Hi Alexey - yes the entire script including the line you mention.

The error occurs very soon on loading, triggered on the very line you refer to I believe.
Title: Re: Newbie - error running a script.
Post by: Alexey Pasumansky on April 22, 2017, 09:37:12 PM
Hello SimonBrown,

And could you input the following lines to the Console pane just for testing and provide the output:
Code: [Select]
from PySide2 import QtWidgets
QtWidgets.QDialog
Title: Re: Newbie - error running a script.
Post by: SimonBrown on April 23, 2017, 12:01:21 PM
Hi Alexey - here's the output:-

Out[1]: 2017-04-23 10:00:35 PySide2.QtWidgets.QDial
Title: Re: Newbie - error running a script.
Post by: Alexey Pasumansky on April 23, 2017, 03:04:48 PM
So it is supposed to be working. Can you then attache the script that you are usign to the post here?
Title: Re: Newbie - error running a script.
Post by: SimonBrown on April 28, 2017, 02:45:49 PM
Hi Alexey

Script file is attached/uploaded.
Title: Re: Newbie - error running a script.
Post by: Alexey Pasumansky on April 28, 2017, 02:51:21 PM
Hello Simon,

In the provided script there's line
Code: [Select]
from PyQt4 import QtGui, QtCoreinstead of
Code: [Select]
from PySide2 import QtGui, QtCore, QtWidgets