bbcmicrobit / PythonEditor

A MicroPython editor for the BBC micro:bit that works with browsers.
https://python.microbit.org/
MIT License
198 stars 130 forks source link

Hex file error #399

Closed microbit-carlos closed 1 year ago

microbit-carlos commented 1 year ago

It seems, github make some processing on microbits hex files. After download from GitHub - error message form Makecode Web: "Sorry, we could not recognize this file". Perhaps Github is not for binary files. It is enough to make a binary file compare between origin HEX file and uploaded/download HEX file. There are many repositories, all with invalid HEX files for micro-bits and the owners are happy. I made now this FC /B f1.hex f2.hex and they are not the same! ;-(

Originally posted by @petulino777 in https://github.com/bbcmicrobit/PythonEditor/issues/55#issuecomment-1328099915

microbit-carlos commented 1 year ago

Hi @petulino777, I've moved your comment to a new thread, as I think it's a different issue than #55.

Could you explain what hex file are you trying to load into what editor? A hex file from the Python Editor (https://python.microbit.org) will only load in the Python Editor, and a MakeCode (https://makecode.microbit.org/) hex file will only load in MakeCode.

petulino777 commented 1 year ago

Hello, I am only an older hobby programmer playing with a micro-bit. Sorry for my bad English. And I just want to keep my little programs somewhere, especially if I switch computers. I've been doing these operations without any client on my computer, just through the chrome browser, and that's how I want to keep using it for the time being. GitHub apparently (at least when uploading/downloading via the browser) treats micro-bit HEX files as text files and modifies them. I have found one SOLUTION when using GitHub using only the browser: Before uploading the first HEX file to a repository, just upload (also via browser) a file named .gitignore to that repository. Its content - one line: *.hex

And then I can add the files downloaded from the repository to MakeCode Web Editor via Import file via the browser and it works! Please close this Issue. Thanks for the help and sorry to have kept you busy here. Peter

microbit-carlos commented 1 year ago

GitHub apparently (at least when uploading/downloading via the browser) treats micro-bit HEX files as text files and modifies them.

To better understand your workflow, are you adding hex files to a GitHub repository and then downloading them? How? using the GitHub website, cloning the repository somewhere else, or some other method? Do you have an example of a hex file uploaded to GitHub that is modified by GitHub?

petulino777 commented 1 year ago

Hi Carlos, I use only the browser to work with github.com My workflow: on the notebook nr. 1 I upload per chrome browser my visual block program - HEX file. On the notebook nr.2 I download this HEX file, again with the chrome browser. I open the web page makecode.microbit.org and then I try -> Import File... and after selecting and opening the HEX file it will be short displayed: "Sorry, we could not recognize this file". It means that the uploaded file on notebook nr.1 and the file downloaded on the notebook nr.2 is not the same - the fc/b showed that the files are different. But after uploading the .gitignore file its all OK. I get the same file on the another notebook (and Import OK). i think, the github thinks that the HEX file is a text file and makes some processing at upload on them. I have the solution for me, thanks for your attention and help.

microbit-carlos commented 1 year ago

Okay, thanks for sharing the workflow and solution! I'll close this as resolved then 👍