Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denilsonsa/9c8f5c44bf2038fd000f to your computer and use it in GitHub Desktop.
Save denilsonsa/9c8f5c44bf2038fd000f to your computer and use it in GitHub Desktop.
Python and C ctypes stdout captured in IPython Notebook - https://stackoverflow.com/questions/35745541
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lvwarren
Copy link

lvwarren commented Dec 8, 2018

When running the notebook it gets as far as the section:

ctypes - Preparing the C library

whereupon I get the following:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-10-684349b68d2d> in <module>()
      5 
      6 # These variables, defined inside the C library, are readonly.
----> 7 cstdin = FILE_p.in_dll(libc, 'stdin')
      8 cstdout = FILE_p.in_dll(libc, 'stdout')
      9 cstderr = FILE_p.in_dll(libc, 'stderr')

ValueError: dlsym(0x11b5c0e50, stdin): symbol not found

on MacOS Mojave 10.14.1 with Python 3.7.0 and Jupyter 5.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment