Skip to content

Mock import of ctypes fails with unsupported operand #1342

Closed
@maphew

Description

@maphew

I have small Windows module that relies on the ctypes core module. On the project RTD site the page for the module comes up empty. Looking at the latest almost successful build log https://readthedocs.org/builds/apt/2900858/ there is a failure during make html stage.

  File "/var/build/user_builds/apt/checkouts/latest/knownpaths.py", line 5, in <module>
    from ctypes import windll, wintypes
  File "/usr/lib/python2.7/ctypes/wintypes.py", line 23, in <module>
    class VARIANT_BOOL(_SimpleCData):
ValueError: _type_ 'v' not supported

Following the FAQ entry https://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules I tried to fake import ctypes using mock, but doing so cause the build to fail completely. From what I can tell, but I'm no means an expert in this area, it's because mock itself is missing some math functions:

  File "/var/build/user_builds/apt/checkouts/latest/knownpaths.py", line 13, in GUID
    ("Data4", wintypes.BYTE * 8)
TypeError: unsupported operand type(s) for *: 'Mock' and 'int'

Full details of the trouble and steps taken so far at maphew/apt#48

Am I following the right path? Can ctypes be used in a project on RTD and I just need to persevere?

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