Thanks Justin and Johannes. I worked around the problem by calling the command line version of Nuke and executing a script that way. I realized I needed a terminal window anyway to print out some progress to the user so it worked well.
Using the python interpreter from Nuke sounds like it should work though. I'll remember that the next time :). /Simon ------------------------------- Simon Björk Compositor/TD +46 (0)70-2859503 www.bjorkvisuals.com 2016-03-22 11:17 GMT+01:00 Johannes Hezer <[email protected]>: > Hi Simon, > > maybe you can run your code with the python interpreter from nuke? > so you already have the root in your PATH and then I always add the > pythonextensions/site-packages folder to PYTHONPATH. > Then there shouldnt be problems with PySide and clashing Dlls. > this just adds to what Justin already said... > > cheers > > > > Am 3/20/16 um 18:43 PM schrieb Justin GD: > > Hey Simon, > > From what I understand I'd say that by importing Nuke, the Qt's > QApplication is instancied with Nuke. > > So when you do: > app = QApplication(sys.argv) > > It shows that error. > Maybe you could test if QApplication is already instancied ? > > app = QApplication.instance() > if app is None: > app = QApplication(sys.argv) > > If yes that mean Nuke is the main app so you don't have to create it. > > Not sure if you want Nuke to run as the main app tho... > > These are just ideas as I never experienced that situation. > > > Cheers, > > Justin > > > > > 2016-03-20 12:36 GMT+00:00 Simon Björk <[email protected]>: > >> Thanks for your reply Justin. >> >> I though I had tried this, but I had another look. >> >> - If I import the nuke module at the top of the script (before importing >> PySide) the nuke module imports without an error. But instead i get this >> when trying to open the PySide panel: >> >> *RuntimeError: A QApplication instance already exists.* >> >> *- *If I import the nuke module at the top (but after PySide) I get a >> Windows pop-up. Seems like a crash? >> >> *python.exe Entry point not found. Could not be found in QtGui4.dll* >> >> Is all this a conflict because Nuke ships with it's own version of PySide >> and that's what's used in the nuke module? >> >> >> >> ------------------------------- >> Simon Björk >> Compositor/TD >> >> +46 (0)70-2859503 <%2B46%20%280%2970-2859503> >> www.bjorkvisuals.com >> >> 2016-03-20 12:48 GMT+01:00 Justin GD < <[email protected]> >> [email protected]>: >> >>> Hi Simon, >>> >>> Could it be because you import nuke in your slot ? Meaning that the >>> scope is that function only ? >>> >>> >>> http://stackoverflow.com/questions/3095071/in-python-what-happens-when-you-import-inside-of-a-function >>> >>> Cheers, >>> Justin >>> >>> 2016-03-19 22:25 GMT+00:00 Simon Björk < <[email protected]> >>> [email protected]>: >>> >>>> I'm trying to import the nuke module from a standalone PySide panel >>>> (not launched from Nuke, using local Python install). See here >>>> <http://pastebin.com/QPzdzaAS> for example code. It gives me an import >>>> error saying it can't import a dll file. >>>> >>>> *ImportError: Failed to load C:\Program Files\Nuke9.0v8\nuke-9.0.8.dll* >>>> >>>> But if I run the same import code as a simple script without PySide it >>>> works. >>>> >>>> sys.path.append("C:/Program Files/Nuke9.0v8/lib/site-packages") >>>> os.environ["NUKE_INTERACTIVE"] = "1" >>>> import nuke >>>> >>>> I have the Nuke9.0v8 folder in my systems PATH env (where the dll file >>>> is located) but I still get the import error. >>>> >>>> It feels like I'm missing something obvious, but I can't get it to >>>> work. Any ideas? >>>> >>>> >>>> Best regards, >>>> Simon >>>> >>>> ------------------------------- >>>> Simon Björk >>>> Compositor/TD >>>> >>>> +46 (0)70-2859503 <%2B46%20%280%2970-2859503> >>>> www.bjorkvisuals.com >>>> >>>> _______________________________________________ >>>> Nuke-python mailing list >>>> [email protected], http://forums.thefoundry.co.uk/ >>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >>>> >>>> >>> >>> _______________________________________________ >>> Nuke-python mailing list >>> [email protected], http://forums.thefoundry.co.uk/ >>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >>> >>> >> >> _______________________________________________ >> Nuke-python mailing list >> [email protected], http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> > > > _______________________________________________ > Nuke-python mailing [email protected], > http://forums.thefoundry.co.uk/http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > > > ____ ESET 13207 (20160320) ____ > The message was checked by ESET Mail Security. > > > > -- > STUDIO RAKETE GmbH > Johannes Hezer, Compositing TD & Stereoscopic SV > Schomburgstr. 120 > D - 22767 Hamburg > [email protected]:+49 <+49> (0)40 - 380 375 69 - 0 > Fax:+49 (0)40 - 380 375 69 - 99 > > ------------------------------------------------------ > Pflichtangaben laut Handelsgesetzbuch und GmbH-Gesetz: > > STUDIO RAKETE GmbH > Schomburgstr. 120 D - 22767 Hamburg > www.studiorakete.de / [email protected] > > Geschaeftsfuehrer: Jana Bohl > > Die Gesellschaft ist eingetragen im Handelregister des > Amtsgerichts Hamburg unter der Nummer HR B 95660 > USt.-ID Nr.: DE 245787817 > > > > ____ ESET 13215 (20160322) ____ > The message was checked by ESET Mail Security. > > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
