2

When trying to open Tera Term using a Python script, I receive the following error:

Traceback (most recent call last): File "", line 1, in shell.Run("C:\Program Files (x86)\teraterm\ttermpro.exe") File "", line 2, in run com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024894), None)

I used this as the following commands in Python shell to recreate the error message:

import os
import win32com.client
from win32com.client import Dispatch
shell = win32com.client.Dispatch("WScript.Shell")
shell.Run("C:\\Program Files (x86)\\teraterm\\ttermpro.exe")

Could anyone clarify what this error means and how I can proceed to solving it? There are a few posts on this, however they remain unanswered.

code_noob
  • 25
  • 1
  • 4
  • 1
    Is there a reason why you have to use `WScript.Shell`? What's wrong with `subprocess.call("C:\\Program Files (x86)\\teraterm\\ttermpro.exe")`? – Aran-Fey Jun 09 '17 at 20:43
  • Yes, I will be executing more commands using the same script. – code_noob Jun 09 '17 at 21:00
  • 1
    Your problem is that your path has un-escaped spaces you need to use `'"C:\\Program Files (x86)\\teraterm\\ttermpro.exe"'` – Steve Barnes Jun 10 '17 at 06:04

0 Answers0