Hi Jason,<div><br></div><div>PySide only supports creating a single persistent instance of QApplication. This singleton exists forever and cannot be deleted.  If you have a function that tries to create a QApplication, then I recommend placing that creation inside of a try/except block:</div>
<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="'courier new', monospace">try:</font></div><div><font face="'courier new', monospace">  app = QtGui.QApplication(sys.argv)</font></div>
<div><font face="'courier new', monospace">except RuntimeError:</font></div><div><font face="'courier new', monospace">  app = QtCore.QCoreApplication.instance()</font></div></blockquote><div><br></div><div>
This will either create a new QApplication instance if one does not exist, or return the current QApplication instance if one already does exist.</div><div><br></div><div>Nathan<br><br><div class="gmail_quote">On Wed, May 23, 2012 at 3:21 PM, Jason Augustyn <span dir="ltr"><<a href="mailto:js.augustyn@gmail.com" target="_blank">js.augustyn@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all, I am new to using PySide and have been working through the novice tutorials, which are great. One problem - I cannot re-run a script without exiting the Python shell altogether. Re-running gives the RuntimeError: A QApplication instance already exists.<br>

<br>I have searched for a solution and found an old bug tracker ticket from someone with a similar problem. The suggested solution was to upgrade to PySide 1.0.4 and the ticket was marked as invalid. Obviously that doesn;t work, as I'm running the newest version of PySide and still have the problem. Any suggestions? I am using IPython on a Mac OSX 10.7.<br>

<br>Thanks!<span class="HOEnZb"><font color="#888888"><br><br>Jason<br>
</font></span><br>_______________________________________________<br>
PySide mailing list<br>
<a href="mailto:PySide@qt-project.org">PySide@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/pyside" target="_blank">http://lists.qt-project.org/mailman/listinfo/pyside</a><br>
<br></blockquote></div><br></div>