When importing AVFoundation with the system provided python (2.7.16) and pyobjc (2.5.1) on Mac OS X 10.15, there is an error:
% python
Python 2.7.16 (default, Feb 29 2020, 01:55:37)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
>>> objc.__version__
'2.5.1'
>>> import AVFoundation
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_bridgesupport.py:674: RuntimeWarning: Error parsing BridgeSupport data for AVFoundation: PyObjCRT_SkipTypeSpec: Unhandled type '5d' ]}
warnings.warn("Error parsing BridgeSupport data for %s: %s" % (frameworkName, e), RuntimeWarning)
On consequence of that (as far as I understand), is that constants are not loaded. Would it be possible to fix that from the running script?
I can not alter the python install because my script has to work on other machines than mine.
It's not the answer your looking for, but the best solution is to install Python 3.8 and a recent version of PyObjC.
Both Python 2.7 and the version of PyObjC included in macOS are no longer supported.