Kivy 1.9.0 / Python 3.4 Windows Package ‘rthooks’ errors, Win7 x64

Trying to package a kivy project to a .exe and getting no-where. Followed instructions http://kivy.org/docs/guide/packaging-windows.html diligently, and even tried the suggestions for packages I didn’t have. Changed my rt_hooks_kivy.py in desparation… didn’t help. Any help super appreciated…

.spec file.

# -*- mode: python -*-

from kivy.tools.packaging.pyinstaller_hooks import install_hooks
import os
install_hooks()



block_cipher = None


a = Analysis(['C:UserstrobertsonDocumentsRobotics-DevPythonLaserSelectorBracingSelectormain.py'],
             pathex=['C:Python34Libsite-packageskivyBracingProd'],
             hiddenimports=[],
             runtime_hooks=None,
             excludes=None,
             cipher=block_cipher)
pyz = PYZ(a.pure,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='BracingProd.exe',
          debug=False,
          strip=None,
          upx=True,
          console=True , icon='C:UserstrobertsonDocumentsRobotics-DevPythonLaserSelectorBracingSelectorTaylor-White-Icon-64.ico')
coll = COLLECT(exe, Tree('C:/Users/trobertson/Documents/Robotics-Dev/Python/LaserSelector/BracingSelector/'),
               Tree([f for f in os.environ.get('KIVY_SDL2_PATH', '').split(';') if 'bin' in f][0]),
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='BracingProd')

failed log:

[INFO              ] Logger: Record log in C:Userstrobertson.kivylogskivy_15-07-17_18.txt
[INFO              ] Kivy: v1.9.0
[INFO              ] Python: v3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)]
[WARNING           ] stderr: Traceback (most recent call last):
[WARNING           ] stderr:   File "C:Kivy-1.9.0-py3.4-win32-x64Python34Scriptspyinstaller-script.py", line 9, in <module>
[WARNING           ] stderr:     load_entry_point('PyInstaller==3.0.dev0', 'console_scripts', 'pyinstaller')()
[WARNING           ] stderr:   File "C:Kivy-1.9.0-py3.4-win32-x64Python34libsite-packagesPyInstallermain.py", line 96, in run
[WARNING           ] stderr:     run_build(opts, spec_file, pyi_config)
[WARNING           ] stderr:   File "C:Kivy-1.9.0-py3.4-win32-x64Python34libsite-packagesPyInstallermain.py", line 49, in run_build
[WARNING           ] stderr:     PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
[WARNING           ] stderr:   File "C:Kivy-1.9.0-py3.4-win32-x64Python34libsite-packagesPyInstallerbuild.py", line 2188, in main
[WARNING           ] stderr:     build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
[WARNING           ] stderr:   File "C:Kivy-1.9.0-py3.4-win32-x64Python34libsite-packagesPyInstallerbuild.py", line 2134, in build
[WARNING           ] stderr:     exec(text, spec_namespace)
[WARNING           ] stderr:   File "<string>", line 5, in <module>
[WARNING           ] stderr:   File "C:Kivy-1.9.0-py3.4-win32-x64kivy34kivytoolspackagingpyinstaller_hooks__init__.py", line 13, in install_hooks
[WARNING           ] stderr:     sym['rthooks']['kivy'] = [join(curdir, 'rt-hook-kivy.py')]
[WARNING           ] stderr: KeyError: 'rthooks'

rt_hooks_kivy.py:

    from os.path import join, dirname
from os import environ, chdir, putenv, getenv
import sys

root = 'kivy_install'
if hasattr(sys, '_MEIPASS'):
    # PyInstaller >= 1.6
    chdir(sys._MEIPASS)
    root = join(sys._MEIPASS, root)
elif '_MEIPASS2' in environ:
    # PyInstaller < 1.6 (tested on 1.5 only)
    chdir(environ['_MEIPASS2'])
    root = join(environ['_MEIPASS2'], root)
else:
    chdir(dirname(sys.argv[0]))
    root = join(dirname(sys.argv[0]), root)


sys.path += [join(root, '_libs')]

if sys.platform == 'darwin':
    sitepackages = join(root, '..', 'sitepackages')
    sys.path += [sitepackages, join(sitepackages, 'gst-0.10')]
    putenv('GST_REGISTRY_FORK', 'no')

environ['GST_PLUGIN_PATH'] = join(root, '..', 'gst-plugins')
environ['KIVY_DATA_DIR'] = join(root, 'data')
environ['KIVY_EXTS_DIR'] = join(root, 'extensions')
environ['KIVY_MODULES_DIR'] = join(root, 'modules')
environ['KIVY_EMBED'] = '1'


Source: windows

Leave a Reply