pyinstaller and plyer (windows)

715 views
Skip to first unread message

Diego

unread,
Feb 2, 2017, 5:44:58 AM2/2/17
to Kivy users support
Hi
my name is Diego and I have created a kivy program, which I want to package for windows.
When I call it as a python script, it works. But when I package it as executable, then it does not work.
I work on a Win7 32bit machine, and python 2.7.

Here the log of the error. And below my SPEC-File for the pyInstaller.

Any help would be very much appreciated!

LOG:
--------------------------
[INFO              ] [Logger      ] Record log in C:\Users\diegosancho\.kivy\logs\kivy_17-02-02_28.txt
[INFO              ] [Screen      ] Apply screen settings for iPad (1 and 2)
[INFO              ] [Screen      ] size=1024x768 dpi=132 density=1 orientation=landscape
[INFO              ] [Kivy        ] v1.9.1
[INFO              ] [Python      ] v2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]
[INFO              ] [Factory     ] 179 symbols loaded
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored)
[INFO              ] [Text        ] Provider: sdl2
[INFO              ] [OSC         ] using <thread> for socket
[INFO              ] [Window      ] Provider: sdl2
[INFO              ] [GL          ] GLEW initialization succeeded
[INFO              ] [GL          ] OpenGL version <2.1.0 - Build 8.15.10.2993>
[INFO              ] [GL          ] OpenGL vendor <Intel>
[INFO              ] [GL          ] OpenGL renderer <Intel(R) HD Graphics>
[INFO              ] [GL          ] OpenGL parsed version: 2, 1
[INFO              ] [GL          ] Shading version <1.20  - Intel Build 8.15.10.2993>
[INFO              ] [GL          ] Texture max size <8192>
[INFO              ] [GL          ] Texture max units <16>
[INFO              ] [Shader      ] fragment shader: <No errors.>
[INFO              ] [Shader      ] vertex shader: <No errors.>
[INFO              ] [Shader      ] program: <No errors.>
[INFO              ] [Window      ] auto add sdl2 input provider
[INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
 Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\plyer\utils.py", line 88, in _ensure_obj
     mod = __import__(module, fromlist='.')
 ImportError: No module named platforms.win.uniqueid
 Traceback (most recent call last):
   File "e:\git\kivy\main.py", line 108, in <module>
     uniqueId = uniqueid.id
   File "C:\Python27\lib\site-packages\plyer\utils.py", line 103, in __getattribute__
     return getattr(object.__getattribute__(self, '_obj'), name)
   File "C:\Python27\lib\site-packages\plyer\facades\uniqueid.py", line 36, in id
     return self.get_uid()
   File "C:\Python27\lib\site-packages\plyer\facades\uniqueid.py", line 39, in get_uid
     return self._get_uid()
   File "C:\Python27\lib\site-packages\plyer\facades\uniqueid.py", line 44, in _get_uid
     raise NotImplementedError()
 NotImplementedError

------------------------------------------------------------------------------------------------------------------------------------

SPEC-FILE:
------------------
# Added by Diego
from kivy.deps import sdl2, glew, gstreamer
import plyer

# -*- mode: python -*-

block_cipher = None


a = Analysis(['e:\\git\\kivy\\main.py'],
             pathex=['e:\\Download\\MyIceCreamLabWindows_neu'],
             binaries=None,
             datas=None,
             hiddenimports=['plyer.platforms.win.uniqueid'],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='myicecreamlab',
          debug=False,
          strip=False,
          upx=True,
          console=False )
coll = COLLECT(exe, Tree('e:\\git\\kivy\\'),
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins + gstreamer.dep_bins)],
               strip=False,
               upx=True,
               name='myicecreamlab',
               icon='e:\\git\\kivy\\Icon-windows.ico')

sebastián lópez

unread,
Feb 8, 2017, 2:18:02 PM2/8/17
to Kivy users support
Hi

I also have the same error under android. So if I use QPYTON Console here is the result

/data/data/org.qpython.qpy/files/bin/qpython-android5.sh && exit
y/files/bin/qpython-android5.sh && exit <
Python 2.7.2 (default, Nov  2 2015, 01:07:37)
[GCC 4.9 20140827 (prerelease)] on linux4
Type "help", "copyright", "credits" or "license" for more information.
>>> from plyer import uniqueid
Traceback (most recent call last):
 File "/data/data/org.qpython.qpy/files/lib/python2.7/site-packages/plyer/utils.py", line 67, in _ensure_obj
   mod = __import__(module, fromlist='.')
 File "/data/data/org.qpython.qpy/files/lib/python2.7/site-packages/plyer/platforms/android/__init__.py", line 2, in <module>
   from jnius import autoclass
 File "/QPython/QPython2-core/build/python-install/lib/python2.7/site-packages/jnius/__init__.py", line 13, in <module>
 File "/QPython/QPython2-core/build/python-install/lib/python2.7/site-packages/jnius/reflect.py", line 9, in <module>
 File "jnius_export_class.pxi", line 44, in jnius.jnius.MetaJavaClass.__new__ (jnius/jnius.c:13255)
SystemError: NULL result without error in PyObject_Call
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/data/data/org.qpython.qpy/files/lib/python2.7/site-packages/plyer/utils.py", line 82, in __getattribute__
   return getattr(object.__getattribute__(self, '_obj'), name)
 File "/data/data/org.qpython.qpy/files/lib/python2.7/site-packages/plyer/facades.py", line 392, in id
   return self.get_uid()
 File "/data/data/org.qpython.qpy/files/lib/python2.7/site-packages/plyer/facades.py", line 395, in get_uid
   return self._get_uid()
 File "/data/data/org.qpython.qpy/files/lib/python2.7/site-packages/plyer/facades.py", line 400, in _get_uid
   raise NotImplementedError()
NotImplementedError
>>>


sebastián lópez

unread,
Feb 8, 2017, 2:46:50 PM2/8/17
to Kivy users support
I guess the error is because the library plyer is returning the uniqueid method from


raise NotImplementedError()

sebastián lópez

unread,
Feb 8, 2017, 2:57:25 PM2/8/17
to Kivy users support

sebastián lópez

unread,
Feb 10, 2017, 6:56:09 AM2/10/17
to Kivy users support
Under android it's possible to use the following code

from jnius import autoclass
activity = autoclass('org.renpy.android.PythonActivity').mActivity
Secure = autoclass('android.provider.Settings$Secure')
machine_id = Secure.getString(activity.getContentResolver(),  Secure.ANDROID_ID)


You just need to inspect the plyer code to get the windows equivalent code related to plyer.uniqueid

Reply all
Reply to author
Forward
0 new messages