question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not launch SnippingTool (elevation is required)

See original GitHub issue

Expected Behavior

Launch SnippingTool.exe

Actual Behavior

Error log below

(PYWINA~1) f:\PCKLIB_Python\WinAutomation>python main.py
Traceback (most recent call last):
  File "C:\Users\PIAODA~1\Envs\PYWINA~1\lib\site-packages\pywinauto\application.py", line 1047, in start
    start_info)                         # STARTUPINFO structure.
pywintypes.error: (2, 'CreateProcess', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    app = Application(backend="uia").start('C:\WINDOWS\system32\SnippingTool.exe')
  File "C:\Users\PIAODA~1\Envs\PYWINA~1\lib\site-packages\pywinauto\application.py", line 1052, in start
    raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "C:\WINDOWS\system32\SnippingTool.exe"
Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')

Short Example of Code to Demonstrate the Problem

I note that I tried both uia and win32 for backend of Application.

from pywinauto import Desktop, Application
app = Application(backend="uia").start('C:\WINDOWS\system32\SnippingTool.exe')

Specifications

  • Pywinauto version: 0.6.8
  • Python version and bitness: Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
  • Platform and OS: Windows 10 64bit

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vasily-v-ryabovcommented, Mar 20, 2021

Hi @myd7349 thanks! This is exactly the root cause. We figured it out some time ago, but I forgot to mention it here because of low priority. And thanks for the references! Really appreciate it.

1reaction
myd7349commented, Mar 22, 2021

The reason: You Win10 is 64-bit, and your Python app might be 32-bit. When you typied C:\WINDOWS\system32\SnippingTool.exe, the file system redirector will redirects it to C:\WINDOWS\SysWOW64\SnippingTool.exe.

To resolve this issue, we may use either of the these ways:

  1. Run the python script with a 64-bit Python;
  2. Disable file system redirector;

References:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot run Snipping Tool - Microsoft Community
Either go to the location and double click on the executable file or run it from start menu. Here's how: a. Go to...
Read more >
SnippingTool.exe not located where it appears to be?
Start("c:\\windows\\system32\\SnippingTool.exe"); it throws an error saying "The system cannot find the file specified at System.Diagnostics.
Read more >
Is Your Snipping Tool Not Working? Here's How to Fix It
The Snipping Tool is a handy way to take screenshots, but sometimes it doesn't want to work with you. Here's how to get...
Read more >
Install Snipping Tool on Windows Server 2012 - Techibee.com
This did not completely enable the snipping tool – once I ran the line below, ... Hello, for the “Requires Elevation error” you...
Read more >
How to detect the Snipping Tool in Windows 7? - Stack Overflow
You can use WMI to monitor process creation (and much more). This blog entry will get you started using WMI from Delphi describing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found