GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — hex2bin error · Issue #4 · python-intelhex/intelhex

hex2bin error #4

New issue
Copy link
New issue
Copy link
Closed
Closed
hex2bin error#4
Copy link

Description

@kript0n
kript0n
opened on Feb 4, 2016
Issue body actions

Hey. I tried use hex2bin function im my code then tried your script and all the time I get this error:
Traceback (most recent call last): File "hex2.py", line 139, in <module> sys.exit(hex2bin(fin, fout, start, end, size, pad)) File "/usr/local/lib/python3.4/dist-packages/intelhex/__init__.py", line 1001, in hex2bin h.tobinfile(fout, start, end) File "/usr/local/lib/python3.4/dist-packages/intelhex/__init__.py", line 412, in tobinfile fobj.write(self._tobinstr_really(start, end, pad, size)) TypeError: must be str, not bytes
Script I use as python3 hex2bin Blinky.hex

Activity

  1. bialix commented on Feb 10, 2016

    @bialix
    bialix
    on Feb 10, 2016
    Member
    More actions

    Hello, it seems there is indeed bug in python3 version. Usually you have to provide output bin filename as last parameter, after filename of input hex file. Without output filename my script tries to write binary data to stdout and that provoked error.

    As workaround try to run command with output filename argument:

    python3 hex2bin Blinky.hex Blinky.bin

  2. bialix commented on Mar 11, 2016

    @bialix
    bialix
    on Mar 11, 2016
    Member
    More actions

    According to http://stackoverflow.com/a/908440 IntelHex on Python3 should use sys.stdout.buffer.write to write binary data to stdout.

  3. bialix
    added a commit that references this issue on Mar 30, 2016

    fixed hex2bin bug @ python3 with binary output to stdout (github issue …

    da956df
  4. bialix commented on Mar 30, 2016

    @bialix
    bialix
    on Mar 30, 2016
    Member
    More actions

    fixed in master.

  5. bialix
    closed this as completedon Mar 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.