Skip to content

Cannot get device instance for empty CD drive on Windows #20

Description

@RibShark

When attempting to run get_device on Windows with an empty CD drive, the CreateFileA call returns a "device not ready" error:

Traceback (most recent call last):
  File "X:\PycharmProjects\DriveExperiments\main.py", line 6, in <module>
    with get_device('E:') as device:
         ^^^^^^^^^^^^^^^^
  File "X:\PycharmProjects\DriveExperiments\.venv\Lib\site-packages\smartie\scsi\windows.py", line 33, in __enter__
    raise ctypes.WinError(ctypes.get_last_error())
PermissionError: [WinError 21] The device is not ready.

A drive shouldn't need to have media inserted in order to send/receive SCSI commands.

Activity

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