Python 3-Ersatz für PyFile_AsFile
Der folgende Code funktioniert in Python 2:
from ctypes import *
## Setup python file -> c 'FILE *' conversion :
class FILE(Structure):
pass
FILE_P = POINTER(FILE)
PyFile_AsFile = pythonapi.PyFile_AsFile # problem here
PyFile_AsFile.argtypes = [py_object]
PyFile_AsFile.restype = FILE_P
fp = open(filename,'wb')
gd.gdImagePng(img, PyFile_AsFile(fp))
In Python 3 gibt es jedoch kein PyFile_AsFile in pythonapi.
Der Code ist eine Ausnahme vontestPixelOps.py.