UFO icon indicating copy to clipboard operation
UFO copied to clipboard

AttributeError: 'NoneType' object has no attribute 'capture_as_image'

Open JackWong007 opened this issue 7 months ago • 3 comments

ENV : UFO:2.0.0 PYTHON:3.10.10

D:\data\UFO2>python -m ufo --task helloufo004

Welcome to use UFO🛸, A UI-focused Agent for Windows OS Interaction.


| | | || | / _
| | | || |
| | | | | |
| || | | || | _
/ |_| __/

Please enter your request to be completed🛸: 在打开的记事本中,输入Hello UFO

Round 1, Step 1, HostAgent: Analyzing the user intent and decomposing the request... Observations👀: The current screenshot shows Visual Studio Code with several files open, a Command Prompt window running a Python script, and a Notepad window open with no text yet. Notepad is in focus and waiting for input. Thoughts💡: The user's request is to input 'Hello UFO' into the opened Notepad document. This task can be completed entirely within the Notepad application, as it is currently open and ready to receive text input. Plans📚: (1) Input 'Hello UFO' into the opened Notepad document. Next Selected application📲: 无标题 - 记事本 Messages to AppAgent📩: Status📊: ASSIGN Comment💬: I will instruct an AppAgent to enter 'Hello UFO' into the currently open Notepad document, completing the user's request. Round 1, Step 2, AppAgent: Completing the subtask [Input 'Hello UFO' into the opened Notepad document.] on application [].


Error Occurs at capture_screenshot Traceback (most recent call last): File "D:\data\UFO2\ufo\agents\processors\basic.py", line 192, in wrapper func(self, *args, **kwargs) File "D:\data\UFO2\ufo\agents\processors\basic.py", line 174, in wrapper result = func(self, *args, **kwargs) File "D:\data\UFO2\ufo\agents\processors\app_agent_processor.py", line 282, in capture_screenshot self.photographer.capture_app_window_screenshot( File "D:\data\UFO2\ufo\automator\ui_control\screenshot.py", line 528, in capture_app_window_screenshot return screenshot.capture(save_path, scalar) File "D:\data\UFO2\ufo\automator\ui_control\screenshot.py", line 79, in capture screenshot = self.control.capture_as_image() AttributeError: 'NoneType' object has no attribute 'capture_as_image'


Markdown file saved to logs/helloufo004//output.md.

JackWong007 avatar May 15 '25 07:05 JackWong007

Does anyone have any updates here? The error seems to occur because the APPLICATION_WINDOW context element is not being set correctly. Something with UIA might potentially be the cause.

AirhornRemix avatar May 30 '25 18:05 AirhornRemix

@JackWong007 @AirhornRemix I can't seem to reproduce this issue on my end. I tested with the command: python -m ufo --task new1 -r "在打开的记事本中,输入Hello UFO".

Could you please share which model you're using? If possible, would you also provide the response.log and request.log files from the logs dir in a pastebin?

nice-mee avatar Jun 12 '25 01:06 nice-mee

我也遇到了同样的问题

imAndyrrr avatar Jul 29 '25 01:07 imAndyrrr