Code Monkey home page Code Monkey logo

Comments (7)

TexZK avatar TexZK commented on August 24, 2024

I can confirm that, there must be a problem with how pyinstaller manages entry points, because it works when launched via Python itself.

The point is hexrec registers file types via the hexrec_types list provided to setuptools.setup(entry_points=...). For some reason, that list is not being read by the hexrec package embedded in the generated executable.

I'm not sure I'm able to fix that, or rather create some workaround.

from hexrec.

TexZK avatar TexZK commented on August 24, 2024

Here I found something that seems to work:
pyinstaller/pyinstaller#3050

I will commit changes soon.

from hexrec.

TexZK avatar TexZK commented on August 24, 2024

@rajanimindteck: tested locally with the latest commit: 39e1096

Please confirm to close the issue.

from hexrec.

rajanimindteck avatar rajanimindteck commented on August 24, 2024

PyInstaller issue is solved with this commit.

from hexrec.

kiesner avatar kiesner commented on August 24, 2024

@TexZK: Issue is not fixed for me even when using commit 39e1096.
In contrast to OP I do not try to generate an .exe for hexrec itself, but import hexrec in another module and try to package that as an executable file.

mymodule.py

    import hexrec.records as hr
    ... 
  • Create and activate a venv
  • Upgrade pip
  • Install hexrec (commit 39e1096) and pyinstaller
  • pyinstaller -y --name mymodule ./mymodule.py
  • Compiled exe throws error:
KeyError: 'unsupported extension: .s19'
[13216] Failed to execute script mymodule

from hexrec.

TexZK avatar TexZK commented on August 24, 2024

@kiesner thanks for pointing this out. I actually have the same problem with an utility script I use at work.
In order to let pyinstaller compile the script into an executable file, I added the following stuff at the beginning as a workaround:

import sys
from typing import MutableMapping
from typing import Type
from typing import cast

import hexrec.records as hr


# Fix missing entry_points with pyinstaller
if hasattr(sys, 'frozen') and getattr(sys, 'frozen') and hasattr(sys, '_MEIPASS'):
    import hexrec.formats.intel
    import hexrec.formats.motorola
    _record_types = cast(MutableMapping[str, Type[hr.Record]], hr.RECORD_TYPES)
    _record_types.update({
        'intel':    hexrec.formats.intel.Record,
        'motorola': hexrec.formats.motorola.Record,
    })

I hope to find a consistent way to make entry_points work, otherwise I will switch back to the old solution, where I populated hexrec.records.RECORD_TYPES manually to their defaults, instead of relying on entry_points.

from hexrec.

TexZK avatar TexZK commented on August 24, 2024

@kiesner You can try again with the latest commit (57f0e31)

from hexrec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.