Search code examples
python-3.xui-automationpywinauto

The ™ symbol in my application is not allowing me to launch the application using pywinauto


I have tried multiple ways to launch my application. In some cases, I am a able to launch it but unable to use the print_control_identifier or in another case, I just am not able to even launch my application. I tried this piece of code shown in pywinauto 0.6.2 getting started document.

# coding: utf-8
# -*- coding: utf-8 -*-
from subprocess import Popen
from pywinauto import Desktop
Popen('TRACE™ 3D Plus.exe', shell=True)
dlg = Desktop(backend="uia").TRACE™ 3D Plus
dlg.wait('visible')

Now, when I run this piece of code from the command prompt, I get the error,

File "3d.py", line 6
dlg = Desktop(backend="uia").TRACE\ufffd 3D Plus
SyntaxError: invalid character in identifier

As I see it, the ™ symbol in my application name is not being interpreted correctly while executing the piece of code.

Any thoughts on the same and what I can do to make it work ?

Thanks in advance !


Solution

  • As we figured out by Skype, the following method works for this app:

    import os
    from pywinauto import Application
    
    exe_folder = "C:\\Program Files (x86)\\Trane\\TRACE 3D Plus"
    executable = os.path.join(exe_folder, "TRACE\u2122 3D Plus.exe")
    
    os.chdir(exe_folder)
    app = Application(backend="uia").start(executable)
    

    It was really hard to run this executable even from cmd.exe. Also we had to change working directory to the folder where executable is. Otherwise it shows internal exception (seems like the app issue).