ValueError: depythonifying 'pointer', got 'str'

Issue #244 resolved
Aaron Elkins
created an issue

Hi, I am running this example

with Python 2.7.14 and PyObjc 4.2.2, and got this error:

Beginning Document '1.pdf'
{'retval': {'null_accepted': True, 'type': '^{__CFURL=}', 'already_cfretained': True}, 'arguments': ({'null_accepted': True, 'type': '^{__CFAllocator=}'}, {'c_array_delimited_by_null': True, 'null_accepted': True, 'type': 'n^t'}, {'_template': True, 'type': 'q'}, {'_template': True, 'type': 'Z'})}
Traceback (most recent call last):
  File "main.py", line 272, in <module>
    sys.exit(main())
  File "main.py", line 266, in main
    dumpPageStreams(inURL, sys.stdout)
  File "main.py", line 186, in dumpPageStreams
    table = createMyOperatorTable();
  File "main.py", line 174, in createMyOperatorTable
    CGPDFOperatorTableSetCallback(myTable, "Do", myOperator_Do)
ValueError: depythonifying 'pointer', got 'str'

What can I do? any help is great.

Comments (2)

  1. Ronald Oussoren repo owner

    This is a bug in the metadata for CGPDFOperatorTableSetCallback.

    A quick workaround is to open Quartz/CoreGraphics/_metadata.py and look for CGPDOperatorTableSetCallback. You'll find this as a key in a dictionary, the value is a tuple of 3 items, the last one of which is a dictionary. Add the following information to that dictionary:

         1: {'c_array_delimited_by_null': True, 'type_modifier': 'n'}
    

    PyObjC 5.0, later this year, will contain a proper fix for this.

  2. Log in to comment