[PyInstaller] pygst,gobject windows problem

717 views
Skip to first unread message

drakkan

unread,
Apr 24, 2010, 7:49:05 AM4/24/10
to PyInstaller
I'm trying to setup a gstreamer based application, the main imports
are the followings:

import pygst
pygst.require("0.10")
import gst
import gobject

after packaging I have this error:

ImportError: No module named gst

I'm using python 2.6.5 on windows, pygst (http://forja.rediris.es/frs/
download.php/1414/Pygst-0.10.15.1-Python26.exe), pygobject (http://
ftp.acc.umu.se/pub/GNOME/binaries/win32/pygobject/2.20/) and
pyinstaller-py26 rev. 825,

any hints?

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.

Florian Höch

unread,
Apr 24, 2010, 4:19:53 PM4/24/10
to pyins...@googlegroups.com
Also happens using trunk, I guess the reason is that the actual
directory containing gst is added to sys.path by pygst.require, and
pyinstaller only sees the pygst import. I could be mistaken though.

Am 24.04.2010 13:49, schrieb drakkan:
> I'm trying to setup a gstreamer based application, the main imports
> are the followings:
>
> import pygst
> pygst.require("0.10")
> import gst
> import gobject
>
> after packaging I have this error:
>
> ImportError: No module named gst
>
> I'm using python 2.6.5 on windows, pygst (http://forja.rediris.es/frs/
> download.php/1414/Pygst-0.10.15.1-Python26.exe), pygobject (http://
> ftp.acc.umu.se/pub/GNOME/binaries/win32/pygobject/2.20/) and
> pyinstaller-py26 rev. 825,
>
> any hints?
--
Florian Höch

Florian Höch

unread,
Apr 24, 2010, 4:34:42 PM4/24/10
to pyins...@googlegroups.com
Correction: pyinstaller sees all imports, but it fails to add gst
because the actual directory containing it is only added to sys.path
when pygst.require is executed. You can check the warnfile, you should
see a warning that gst could not be imported.

drakkan

unread,
Apr 24, 2010, 4:56:06 PM4/24/10
to PyInstaller
Thanks Florian,

do you have a fix too?

I tryed to manually add gst to sys.path but in the warnfile I see the
warning about gst import

Florian Höch

unread,
Apr 24, 2010, 5:08:20 PM4/24/10
to pyins...@googlegroups.com
Sorry, no. I think it could be handled by an import hook.

drakkan

unread,
Apr 24, 2010, 5:10:14 PM4/24/10
to PyInstaller
Ok solved, I added the gst path to pathex,

thanks

Giovanni Bajo

unread,
Apr 26, 2010, 3:36:50 AM4/26/10
to pyins...@googlegroups.com
On Sat, 24 Apr 2010 22:34:42 +0200, Florian Höch <floria...@gmx.de>
wrote:
> Correction: pyinstaller sees all imports, but it fails to add gst
> because the actual directory containing it is only added to sys.path
> when pygst.require is executed. You can check the warnfile, you should
> see a warning that gst could not be imported.

So, how does the "import pygst" line ever usually work?
--
Giovanni Bajo :: ra...@develer.com
Develer S.r.l. :: http://www.develer.com

My Blog: http://giovanni.bajo.it

Florian Höch

unread,
Apr 26, 2010, 8:10:12 AM4/26/10
to pyins...@googlegroups.com
pygst lies directly in site-packages and basically just contains the
require() function. So in a script you always do `import pygst`,
`pygst.require(version)` and it will add the correct gst-<version>
directory (there can be several concurrent different versions) to
sys.path. Then, you do `import gst`.

Am 26.04.2010 09:36, schrieb Giovanni Bajo:
> On Sat, 24 Apr 2010 22:34:42 +0200, Florian Höch<floria...@gmx.de>
> wrote:
>> Correction: pyinstaller sees all imports, but it fails to add gst
>> because the actual directory containing it is only added to sys.path
>> when pygst.require is executed. You can check the warnfile, you should
>> see a warning that gst could not be imported.
>
> So, how does the "import pygst" line ever usually work?
--
Florian Höch

Giovanni Bajo

unread,
Apr 26, 2010, 1:30:08 PM4/26/10
to pyins...@googlegroups.com
On Mon, 2010-04-26 at 14:10 +0200, Florian Höch wrote:
> pygst lies directly in site-packages and basically just contains the
> require() function. So in a script you always do `import pygst`,
> `pygst.require(version)` and it will add the correct gst-<version>
> directory (there can be several concurrent different versions) to
> sys.path. Then, you do `import gst`.

Ah, the joy of pkg_resources and its runtime magic :)

I think another workaround is to add import pygst; pygst.require("...")
within the spec file itself. Not beautiful, but still better than
hardcoding its full path in pathex.

I think the best solution for PyInstaller would be to:

1) Detect calls to pkgname.require() (not easy)
2) Create and invoke a wrapper script that does something like:
import pygst
pygst.require("whatever")
print sys.path
3) Dynamically add the new paths to the pathex


--
Giovanni Bajo :: ra...@develer.com
Develer S.r.l. :: http://www.develer.com

My Blog: http://giovanni.bajo.it
Last post: Grey on black: combining greylisting with blacklists
Reply all
Reply to author
Forward
0 new messages