Join our discord community

Please or Register to create posts and topics.

Crashing when taking the screenshot

Page 1 of 2Next

Both when saving a new file with a comment and when creating a new export job using the screenshot feature causes Maya to crash. I've had some luck with saving with comment but with out fail using the screenshot in the statemanager always causes a crash.

Which version of Maya are you using?

I just tested it in 2019 and 2020 without problem.

If you are using the same versions it might be caused by something else like an unusual monitor setup or other plugins.

Did this start recently after updating to a new Prism version?

Hi Richard!

 

I am actually working on Prism with metzlerh, and I'm running into the same problem on my separate computer. We are using a server from a few miles away at our University. We just updated to 1.3, and we've tried this on at least 2 separate projects we've created for practice/experimentation. I have also tried to uninstall and reinstall Prism with no luck. Comments and Descriptions are fine, but as soon as I take a preview picture, it thinks for a few minutes and then crashes Maya. We are using Maya 2020.

It seems like it worked fine when we were using the previous version of Prism with Maya 2020. This is an issue that just came up after we updated!

Thanks for the additional information. I still don't know at which point exactly it is crashing, so I'd need your help to track that down. I prepared a small python snippet, which is a slightly modified version of the screengrab code in Prism. Please copy it in the Maya script editor and execute it as python code.

import sys
 
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
 
class ScreenShot(QDialog):
    def __init__(self):
        print("2 init start")
        super(ScreenShot, self).__init__()
        self.imgmap = None
        self.origin = None
        print("3 init start")
        desktop = QApplication.desktop()
        print("4 init start")
        uRect = QRect()
        print("5 init start")
        for i in range(desktop.screenCount()):
            print("6 screen count")
            uRect = uRect.united(desktop.screenGeometry(i))
 
        print("7 counted")
 
        width, height = uRect.width(), uRect.height()
        print("8 got size")
        self.setAttribute(Qt.WA_TranslucentBackground)
        print("9 set background")
        self.setCursor(Qt.CrossCursor)
        print("10 set cursor")
        self.setGeometry(0, 0, width, height)
        print("11 set geometry")
 
        self.setWindowFlags(
            Qt.FramelessWindowHint  # hides the window controls
            | Qt.WindowStaysOnTopHint  # forces window to top... maybe
            | Qt.SplashScreen  # this one hides it from the task bar!
        )
        print("12 set flags")
 
        self.rubberband = QRubberBand(QRubberBand.Rectangle, self)
        print("13 create rubberband")
        self.rubberband.setWindowOpacity(0)
        print("14 set rubber opacity")
        self.setMouseTracking(True)
        print("15 set mouse tracking")
 
    @err_catcher(name=__name__)
    def mousePressEvent(self, event):
        print("17 press event start")
        self.origin = event.pos()
        self.rubberband.setGeometry(QRect(self.origin, QSize()))
        QWidget.mousePressEvent(self, event)
        print("18 press event done")
 
    @err_catcher(name=__name__)
    def mouseMoveEvent(self, event):
        print("19 move event start")
        if self.origin is not None:
            rect = QRect(self.origin, event.pos()).normalized()
            self.rubberband.setGeometry(rect)
 
        self.repaint()
        QWidget.mouseMoveEvent(self, event)
        print("20 move event done")
 
    @err_catcher(name=__name__)
    def paintEvent(self, event):
        print("21 paint event start")
        painter = QPainter(self)
 
        painter.setBrush(QColor(0, 0, 0, 100))
        painter.setPen(Qt.NoPen)
        painter.drawRect(event.rect())
 
        if self.origin is not None:
            rect = QRect(self.origin, QCursor.pos())
            painter.setCompositionMode(QPainter.CompositionMode_Clear)
            painter.drawRect(rect)
            painter.setCompositionMode(QPainter.CompositionMode_SourceOver)
 
            pen = QPen(QColor(200, 150, 0, 255), 1)
            painter.setPen(pen)
            painter.drawLine(rect.left(), rect.top(), rect.right(), rect.top())
            painter.drawLine(rect.left(), rect.top(), rect.left(), rect.bottom())
            painter.drawLine(rect.right(), rect.top(), rect.right(), rect.bottom())
            painter.drawLine(rect.left(), rect.bottom(), rect.right(), rect.bottom())
 
        QWidget.paintEvent(self, event)
        print("22 paint event start")
 
    @err_catcher(name=__name__)
    def mouseReleaseEvent(self, event):
        print("23 release event start")
        if self.origin is not None:
            self.rubberband.hide()
            self.hide()
            rect = self.rubberband.geometry()
            desktop = QApplication.desktop()
            if hasattr(QApplication, "primaryScreen"):
                screen = QApplication.primaryScreen()
            else:
                screen = QPixmap
 
            print("24 got screen")
 
            winID = desktop.winId()
            if sys.version[0] == "2":
                try:
                    winID = long(winID)
                except:
                    pass
            print("25 before grab")
            try:
                self.imgmap = screen.grabWindow(
                    winID, rect.x(), rect.y(), rect.width(), rect.height()
                )
            except:
                self.imgmap = screen.grabWindow(
                    int(winID), rect.x(), rect.y(), rect.width(), rect.height()
                )
            print("26 after grab")
            self.close()
        QWidget.mouseReleaseEvent(self, event)
        print("27 release event done")
 
 
print("1 start")
ss = ScreenShot()
print("16 initialized")
ss.exec_()
print("28 executed")
print(ss.imgmap)

It contains a lot of print statements so we can see what the last message is in the script editor before it crashes.

This is what I got in the script editor when I executed it as a python code. I got an error "#Error: NameError: file <maya console> line 47: name 'err_catcher' is not defined".  So I'm not sure it's executable, unless I'm missing a part of this. I have limited knowledge on coding so maybe I'm missing something? Here's a picture of the result when I execute it.

 

 

Uploaded files:
  • You need to login to have access to uploads.

My mistake. I forgot to remove a few more lines. Try this:

import sys
 
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
 
class ScreenShot(QDialog):
    def __init__(self):
        print("2 init start")
        super(ScreenShot, self).__init__()
        self.imgmap = None
        self.origin = None
        print("3 init start")
        desktop = QApplication.desktop()
        print("4 init start")
        uRect = QRect()
        print("5 init start")
        for i in range(desktop.screenCount()):
            print("6 screen count")
            uRect = uRect.united(desktop.screenGeometry(i))
 
        print("7 counted")
 
        width, height = uRect.width(), uRect.height()
        print("8 got size")
        self.setAttribute(Qt.WA_TranslucentBackground)
        print("9 set background")
        self.setCursor(Qt.CrossCursor)
        print("10 set cursor")
        self.setGeometry(0, 0, width, height)
        print("11 set geometry")
 
        self.setWindowFlags(
            Qt.FramelessWindowHint  # hides the window controls
            | Qt.WindowStaysOnTopHint  # forces window to top... maybe
            | Qt.SplashScreen  # this one hides it from the task bar!
        )
        print("12 set flags")
 
        self.rubberband = QRubberBand(QRubberBand.Rectangle, self)
        print("13 create rubberband")
        self.rubberband.setWindowOpacity(0)
        print("14 set rubber opacity")
        self.setMouseTracking(True)
        print("15 set mouse tracking")
 
    def mousePressEvent(self, event):
        print("17 press event start")
        self.origin = event.pos()
        self.rubberband.setGeometry(QRect(self.origin, QSize()))
        QWidget.mousePressEvent(self, event)
        print("18 press event done")
 
    def mouseMoveEvent(self, event):
        print("19 move event start")
        if self.origin is not None:
            rect = QRect(self.origin, event.pos()).normalized()
            self.rubberband.setGeometry(rect)
 
        self.repaint()
        QWidget.mouseMoveEvent(self, event)
        print("20 move event done")
 
    def paintEvent(self, event):
        print("21 paint event start")
        painter = QPainter(self)
 
        painter.setBrush(QColor(0, 0, 0, 100))
        painter.setPen(Qt.NoPen)
        painter.drawRect(event.rect())
 
        if self.origin is not None:
            rect = QRect(self.origin, QCursor.pos())
            painter.setCompositionMode(QPainter.CompositionMode_Clear)
            painter.drawRect(rect)
            painter.setCompositionMode(QPainter.CompositionMode_SourceOver)
 
            pen = QPen(QColor(200, 150, 0, 255), 1)
            painter.setPen(pen)
            painter.drawLine(rect.left(), rect.top(), rect.right(), rect.top())
            painter.drawLine(rect.left(), rect.top(), rect.left(), rect.bottom())
            painter.drawLine(rect.right(), rect.top(), rect.right(), rect.bottom())
            painter.drawLine(rect.left(), rect.bottom(), rect.right(), rect.bottom())
 
        QWidget.paintEvent(self, event)
        print("22 paint event start")
 
    def mouseReleaseEvent(self, event):
        print("23 release event start")
        if self.origin is not None:
            self.rubberband.hide()
            self.hide()
            rect = self.rubberband.geometry()
            desktop = QApplication.desktop()
            if hasattr(QApplication, "primaryScreen"):
                screen = QApplication.primaryScreen()
            else:
                screen = QPixmap
 
            print("24 got screen")
 
            winID = desktop.winId()
            if sys.version[0] == "2":
                try:
                    winID = long(winID)
                except:
                    pass
            print("25 before grab")
            try:
                self.imgmap = screen.grabWindow(
                    winID, rect.x(), rect.y(), rect.width(), rect.height()
                )
            except:
                self.imgmap = screen.grabWindow(
                    int(winID), rect.x(), rect.y(), rect.width(), rect.height()
                )
            print("26 after grab")
            self.close()
        QWidget.mouseReleaseEvent(self, event)
        print("27 release event done")
 
 
print("1 start")
ss = ScreenShot()
print("16 initialized")
ss.exec_()
print("28 executed")
print(ss.imgmap)

I had to print the screen right before it crashed haha!

This is what the last part of the script looked like right before it crashes. It looks like as soon as I make the box to make the preview, Maya freezes with the cross-hair cursor. As soon as I let go of the mouse to confirm the picture, that one line showed up that says "23 release event start" Here's a picture of the script editor and Maya. Maya will just force close. No error or anything.

Uploaded files:
  • You need to login to have access to uploads.

Thanks, that shows in which function the problem is, but to see which line exactly is causing that I attached an updated script. Can you run this and post the result again?

You mentioned you are working on a distant server in your university. Does this mean your files are just stored there or are you also working remotely and Maya is running on a remote workstation? If that's the case are there any physical monitors connected to the remote workstation?

I'm testing with Maya 2020.0, but there is also .1 and .2 which could potentially make a difference. Which one of them are you using?

The last question is if this happens only in Maya or also in Prism Standalone. You can check that by opening the Project Browser from the windows start menu and click on "Send feedback..." in the menu bar. In that dialog there is a button "Attach Screengrab", which does the same as the screengrab in Maya. You don't have to send the mail, but you can see if the screengrab works outside of Maya.

import sys
 
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
 
class ScreenShot(QDialog):
    def __init__(self):
        print("2 init start")
        super(ScreenShot, self).__init__()
        self.imgmap = None
        self.origin = None
        print("3 init start")
        desktop = QApplication.desktop()
        print("4 init start")
        uRect = QRect()
        print("5 init start")
        for i in range(desktop.screenCount()):
            print("6 screen count")
            uRect = uRect.united(desktop.screenGeometry(i))
 
        print("7 counted")
 
        width, height = uRect.width(), uRect.height()
        print("8 got size")
        self.setAttribute(Qt.WA_TranslucentBackground)
        print("9 set background")
        self.setCursor(Qt.CrossCursor)
        print("10 set cursor")
        self.setGeometry(0, 0, width, height)
        print("11 set geometry")
 
        self.setWindowFlags(
            Qt.FramelessWindowHint  # hides the window controls
            | Qt.WindowStaysOnTopHint  # forces window to top... maybe
            | Qt.SplashScreen  # this one hides it from the task bar!
        )
        print("12 set flags")
 
        self.rubberband = QRubberBand(QRubberBand.Rectangle, self)
        print("13 create rubberband")
        self.rubberband.setWindowOpacity(0)
        print("14 set rubber opacity")
        self.setMouseTracking(True)
        print("15 set mouse tracking")
 
    def mousePressEvent(self, event):
        print("17 press event start")
        self.origin = event.pos()
        self.rubberband.setGeometry(QRect(self.origin, QSize()))
        QWidget.mousePressEvent(self, event)
        print("18 press event done")
 
    def mouseMoveEvent(self, event):
        print("19 move event start")
        if self.origin is not None:
            rect = QRect(self.origin, event.pos()).normalized()
            self.rubberband.setGeometry(rect)
 
        self.repaint()
        QWidget.mouseMoveEvent(self, event)
        print("20 move event done")
 
    def paintEvent(self, event):
        print("21 paint event start")
        painter = QPainter(self)
 
        painter.setBrush(QColor(0, 0, 0, 100))
        painter.setPen(Qt.NoPen)
        painter.drawRect(event.rect())
 
        if self.origin is not None:
            rect = QRect(self.origin, QCursor.pos())
            painter.setCompositionMode(QPainter.CompositionMode_Clear)
            painter.drawRect(rect)
            painter.setCompositionMode(QPainter.CompositionMode_SourceOver)
 
            pen = QPen(QColor(200, 150, 0, 255), 1)
            painter.setPen(pen)
            painter.drawLine(rect.left(), rect.top(), rect.right(), rect.top())
            painter.drawLine(rect.left(), rect.top(), rect.left(), rect.bottom())
            painter.drawLine(rect.right(), rect.top(), rect.right(), rect.bottom())
            painter.drawLine(rect.left(), rect.bottom(), rect.right(), rect.bottom())
 
        QWidget.paintEvent(self, event)
        print("22 paint event start")
 
    def mouseReleaseEvent(self, event):
        print("23 release event start")
        print(sys.modules["PySide2.QtCore"].__version_info__)
        if self.origin is not None:
            print("a")
            self.rubberband.hide()
            print("b")
            self.hide()
            print("c")
            rect = self.rubberband.geometry()
            print(rect)
            desktop = QApplication.desktop()
            print(desktop)
            if hasattr(QApplication, "primaryScreen"):
                print("f")
                screen = QApplication.primaryScreen()
                print(screen)
            else:
                print("h")
                screen = QPixmap
                print(screen)
 
            print("24 got screen")
 
            winID = desktop.winId()
            if sys.version[0] == "2":
                try:
                    winID = long(winID)
                except:
                    pass
            print("25 before grab")
            try:
                self.imgmap = screen.grabWindow(
                    winID, rect.x(), rect.y(), rect.width(), rect.height()
                )
            except:
                self.imgmap = screen.grabWindow(
                    int(winID), rect.x(), rect.y(), rect.width(), rect.height()
                )
            print("26 after grab")
            self.close()
        print("j")
        QWidget.mouseReleaseEvent(self, event)
        print("27 release event done")
 
 
print("1 start")
ss = ScreenShot()
print("16 initialized")
ss.exec_()
print("28 executed")
print(ss.imgmap)
Quote from RichardF on 16. August 2020, 9:51

Thanks, that shows in which function the problem is, but to see which line exactly is causing that I attached an updated script. Can you run this and post the result again?

You mentioned you are working on a distant server in your university. Does this mean your files are just stored there or are you also working remotely and Maya is running on a remote workstation? If that's the case are there any physical monitors connected to the remote workstation?

I'm testing with Maya 2020.0, but there is also .1 and .2 which could potentially make a difference. Which one of them are you using?

The last question is if this happens only in Maya or also in Prism Standalone. You can check that by opening the Project Browser from the windows start menu and click on "Send feedback..." in the menu bar. In that dialog there is a button "Attach Screengrab", which does the same as the screengrab in Maya. You don't have to send the mail, but you can see if the screengrab works outside of Maya.

We are using a remote server at our University, but using Prism and our programs at our respective home desktops. We use a remote VPN to access our project file when working in Prism, but everything besides where the files are located is running at home.

My version of Maya says Autodesk Maya 2020 under the Version in "About Maya", so I believe that means it's the .0 version?

As for the screengrab inside of Prism, that is working perfectly for Send Feedback, assetinfo and shotinfo.

And as for the result, the exact same thing happened. The picture I sent you above is identical to the result, unfortunately!

Let me know what else I can do to help you troubleshoot this! I'm about to head off for the evening but I will definitely check back when I'm back at work and see what's going on! Thanks again for troubleshooting this with me, it is much appreciated!

 

I also just realized that when I uninstalled the previous version of Prism and then installed it again, I manually deleted the Prism folder after running the uninstall.bat file, but I never manually deleted the shelf from Maya. Do you think this could have caused any of the issues? I assumed it wouldn't, but I thought this could be information you could potentially use!

Page 1 of 2Next