BetaRavener / uPyLoader

File transfer and communication tool for MicroPython boards
MIT License
355 stars 76 forks source link

Init transfer file failed #51

Closed mhe-fr closed 6 years ago

mhe-fr commented 6 years ago

Hello, I'm working on a project with an esp32 and I've try some other tools like uPyCraft but uPyloader is the best.

If the "path to custom transfer files" is set (config.json "external_transfer_scripts_folder" != None) the command : File/Init transfer files fail.

In the code I see you expect this beavior to send custom upload and downlod files. But if file doesn't exist you raise an error. Is it possible to send default file insteed.

In Serial_connection.py line 186 to 191 we could replace

            if os.path.isfile(path):
                return path
            else:
                raise FileNotFoundError

        return PyInstallerHelper.resource_path("mcu/" + transfer_file_name)

by

           if os.path.isfile(path):
                return path

        return PyInstallerHelper.resource_path("mcu/" + transfer_file_name)

Matthieu

BetaRavener commented 6 years ago

Hi, thanks for liking the uPyLoader. Regarding the change, I'd rather know that sending custom scripts failed than sending the original ones. It shouldn't crash (I'll make it display error if it does). So, if you're trying to send non-existent files, it's correct behavior. However, I understand that you would like to send original files. You can do this by clearing the input field for custom files in settings (the condition if Settings().external_transfer_scripts_folder: does not only check for None, but also empty string). However, I realized this is not exactly clear when you don't look at code, so I'll be adding check-box by which you'll explicitly mark that you'd like to use custom transfer scripts. Leaving it unchecked will send the original packed with uPyLoader.

mhe-fr commented 6 years ago

Thank you. It's a good alternative.

BetaRavener commented 6 years ago

Checkbox added.