Instead of requiring the end user to have an external Python interpreter, a 
PySide build, *and* pysideuic installed, why not just require that they have 
pysideuic available somewhere on the PYTHONPATH when Nuke is launched? It’s a 
pretty standard way of handling external dependencies for Python modules that 
require them...

-Nathan



From: Fredrik Averpil 
Sent: Sunday, September 08, 2013 9:54 PM
To: Nuke Python discussion 
Subject: [Nuke-python] Re: Get system's site-packages location from withinNuke?

Unfortunately, for me, the app is already created and working in Maya as well 
as completely standalone. It even works if you prefer PyQt over PySide. So I 
would have to go over about a thousand rows of code if I want to use QUiLoader 
and make exceptions everywhere. It would become a total mess, code-wise. 

But I think I figured out a way to grab the system's site-packages and import 
pysideuic (by launching a subprocess and query sys.path) outside of Nuke. 


Regards,
Fredrik



Den söndagen den 8:e september 2013 skrev Sebastian Elsner:

  You are totally right :) I never do it and it is also not recommended, but in 
special cases (like delivering software with a minimum dependency) i think its 
OK.

  Am 08.09.2013 18:58, schrieb Fredrik Averpil:

Hi Sebastian,

That's exactly what I *don't* want to do :)

The reason is QUiLoader cannot store the .ui directly into the class (self)
that loads the UI file. Instead QUiLoader stores the UI into a new object
(e.g. self.object.myPusButton). This makes for very messy coding, in my
opinion.


// Fredrik


On Sun, Sep 8, 2013 at 6:51 PM, Sebastian Elsner javascript:_e({}, 'cvml', 
'[email protected]');wrote:

 You could always fall back to QUiLoader to remove that dependency and
load the ui files directly.


 Am 08.09.2013 18:39, schrieb Fredrik Averpil:

Hi Deke,

Yeah, you're right. It could have been solved by setting up an environment
variable and reading that. It's just that I'm going to distribute this
script (which requires pyside's pysideuic) onto machines with unknown
setup. Since pysideuic doesn't come with nuke's pyside, I will require
python 2.6 and pyside for python 2.6 to be installed in the system so I can
load pysideuic from there.

I've been in touch with the support to request to have pysideuic included
in nuke's own site-packages, but it seems that is not happening. It's a
shame, quite frankly, as I believe pysideuic really would be beneficial to
have ready, already bundled, running on a nuke-compatible python version.
It's used in everything I do, PySide-wise, and makes for compatible code
that can run in Maya or completely standalone without any modification.

Anyway, it would be kind of nice not to have to set an environment variable
and instead somehow figure out the location of the system's site-packages
location.


// Fredrik





On Sun, Sep 8, 2013 at 5:54 PM, Deke Kincaid javascript:_e({}, 'cvml', 
'[email protected]'); javascript:_e({}, 'cvml', '[email protected]'); 
wrote:


 Nuke currently uses 2.6.5 btw, not 2.7.

Since it's windows you probably need to set your PYTHONHOME env variable
to your local install.

-deke


On Sunday, September 8, 2013, Fredrik Averpil wrote:


 Hey,

In Nuke, I need to somehow get the path to my *system's* site-packages
folder. I do not want the Nuke-distributed packages folder.

I've tried to import site; print site.getsitepackages() but that's just
for python 2.7 (and I'm using python 2.6).

I've also tried
for envPath in sys.path:
    if 'site-packages' in envPath:
        print envPath

As well as from distutils.sysconfig import get_python_lib;
print(get_python_lib())


...but that just returns Nuke's site-packages folder. Is there no way to
grab e.g. C:/python26/Lib/site-packages/ from within Nuke?



// Fredrik



 --
-----
Deke Kincaid
Creative Specialist
The Foundry
Mobile: (310) 883 4313
Tel: (310) 399 4555 - Fax: (310) 450 4516

The Foundry Visionmongers Ltd.
Registered in England and Wales No: 4642027

_______________________________________________
Nuke-python mailing javascript:_e({}, 'cvml', 
'[email protected]');, 
http://forums.thefoundry.co.uk/http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python



_______________________________________________
Nuke-python mailing javascript:_e({}, 'cvml', 
'[email protected]');, 
http://forums.thefoundry.co.uk/http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python



_______________________________________________
Nuke-python mailing list
javascript:_e({}, 'cvml', '[email protected]');, 
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python



     

_______________________________________________
Nuke-python mailing list
javascript:_e({}, 'cvml', '[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

Reply via email to