@cvp That is really unfortunate.
Any ideas as to what in particular are the breaking changes?
Is it Pythonista, or Python 3.10, or the deprecation of oauth2client, or perhaps something else?
@cvp By crashing, I mean literally that: the app will suddenly close in the middle of the script's execution.
Interestingly, the script will crash even if the entire code is placed within a try/except block, which fails to handle whatever error is causing the crash.
The script I am referring to is the one originally posted by @omz and which begins with
from objc_util import * import time import threading C = ObjCClass def take_photo_now(filename='photo.jpg'):
However, I have managed to modify the script you posted, which begins with
from objc_util import * import time AVCaptureSession = ObjCClass('AVCaptureSession') AVCaptureDevice = ObjCClass('AVCaptureDevice') AVCaptureDeviceInput = ObjCClass('AVCaptureDeviceInput') AVCapturePhotoOutput = ObjCClass('AVCapturePhotoOutput') def manualCapture(device, output, focusDistance, fileName):
So thanks for that.
However, I am stuck trying to figure out how to achieve better image focus for the outputs.
I need to capture images of documents being displayed on a laptop screen. If I set the focal distance in the script just right, I can get the some of the text to come out clearly in the image. However, the result is not as clear as when I take a photo manually (via the user interface) and select the focal point by tapping on the iPhone screen.
I am guessing there is a lot of additional stuff going on in an iPhone to adjust for white balance, exposure, focal distance, focus modes, etc. in order to optimize the clarity and quality of the resulting image.
If you have any quick thoughts about that, I'd be glad to hear.
I've actually been stuck pretty badly on the next issue (arguably more important for my use case).
I was planning to post another question about this, but I cannot find a way to connect to Google Drive — which is where I need to upload the images captured by the Pythonista script.
In the case of either library,
StaSh has trouble downloading wheels for certain dependencies.
Also, it appears that
oauth2client is deprecated by Google going forward.
I have a working version of a script (running from my laptop) that authenticates with my drive and uploads/downloads files correctly. So my bottleneck is really about getting it to work withing Pythonista.
I know this was once a pain point for you as well. Are you still able to upload files from Pythonista to your Google Drive?
@omz I just downloaded Pythonista in part because of the very functionality that was offered by the script in the linked post (i.e., capture an image from the camera without requiring user interaction).
However, the original script causes Pythonista to crash. My guess is that something is conflicting with the latest version of Python that comes installed on Pythonista.
Any thoughts on specifically why the code is crashing and/or how the code can be modified to work as it originally was intended?
Thanks for any help