I'm converting a lot of python2 scripts that use pyobjc to python3, and having trouble getting them to work. The problem seems to relate to the Unicode changes in python3.
Something as simple as supplying a string to method like this: provider = CGDataProviderCreateWithFilename(filename) gives: ValueError: depythonifying 'char', got 'str' of 1 I can get it to work if I encode the string first: filenameNonU = filename.encode('utf-8') provider = CGDataProviderCreateWithFilename(filenameNonU) But that will only work for “ASCII” range characters. Any characters greater than 128 gives: ValueError: depythonifying 'char', got 'int' of wrong magnitude It all works perfectly in python2. I presume because objc wants “const char *filename”, rather than an actual string. How should I be presenting these strings? I’ve been struggling with this for years, and so stayed on python2 as long as possible. Thanks Ben Byram-Wigfield _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG