Skip to content

uflash fails to find microbit #59

Open

Description

@rhubarbdog

I was trying some blocks and returned to micropython.
when i tried command uflash my-script.py i get error message
Error flashing pongo.py to microbit: Unable to find micro:bit. Is it plugged in?

solution
uflash my-script.py ~/Downloads
that creates a micropython.hex in ~/Downloads I just copied that using a GUI file manager to my microbit

but with this script now flashed to the micobit uflash my-script.py still fails

Activity

  1. spalbird commented on Aug 7, 2020

    @spalbird

    Our company IT does not allow booting from removeable drive. Maybe a security mechanism alters a return value? Not sure...

    I located following problem in uflash.py in find_microbit() function:
    "if ctypes.windll.kernel32.GetDriveTypeW(path) != 2:" will fail because this function returns 1 on my Window10 company PC

    from https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdrivetypew

    1 DRIVE_NO_ROOT_DIR (The root path is invalid; for example, there is no volume mounted at the specified path.)
    2 DRIVE_REMOVABLE (The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.)

    I changed the line to
    "if not ctypes.windll.kernel32.GetDriveTypeW(path) in (1, 2):"

    Download uflash-1.3.0.tar.gz from https://pypi.org/project/uflash/#files
    Modify line as described above
    reinstall with "python setup.py install"

    If it still doesn't work for you debug uflash.py yourself.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions