pythoncom error: Unexpected gateway error

Found a bug in EventGhost? Report it here.
Post Reply
popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

pythoncom error: Unexpected gateway error

Post by popy » Thu May 03, 2018 10:40 am

Hey guys.

I have two windows clients with the latest EG 4.1.1722 (also tried the latest 0.5.0 beta with no difference).
Booth have Windows 10 x64 1709 version.
On one client everytime ill start EG i have this in the log:

Code: Select all

pythoncom error: ERROR: server.policy could not create an instance.

Traceback (most recent call last):
  File "win32com\server\policy.pyc", line 121, in CreateInstance
  File "win32com\server\policy.pyc", line 719, in resolve_func
KeyError: ''
pythoncom error: Unexpected gateway error

Traceback (most recent call last):
  File "win32com\server\policy.pyc", line 121, in CreateInstance
  File "win32com\server\policy.pyc", line 719, in resolve_func
KeyError: ''
pythoncom error: CPyFactory::CreateInstance failed to create instance. (80004005)
Unable to establish COM dispatch!
---> Willkommen beim EventGhost <---
Autostart
have tried the following without success to solve it:
  • Reinstall EG 4.1.1722 and tried 0.5.0 latest beta -> issue not solved
  • Created an new, empty config xml -> issue not solved
Can you please guide me in the right direction to solve the issue.

Thank you
pOpY

User avatar
kgschlosser
Site Admin
Posts: 4179
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: pythoncom error: Unexpected gateway error

Post by kgschlosser » Thu May 03, 2018 8:24 pm

We want to rule out any possible old data files that might be kicking about. Please follow the instructions word for word. do not skip a single step or change the order in which they are done. This is super important because if you do not follow these instructions you can end up with possible loss of save information. It is always best to backup your data first. Do not rely on the backup provided in these directions. If one backup is good. 2 is way better.

I am not responsible for a lost or corrupted EventGhost save file. (standard disclosure)

Please download the latest stable build. it can be gotten by clicking on the build icon at the top of the forum. Do not install it yet.

run EventGhost and copy and paste the following code into a python script action.

Code: Select all

import shutil
import os

BACKUP_PATH = os.path.join(os.path.expandvars('%USERPROFILE%'), 'Desktop', 'EventGhost_Backup')
CORE_BACKUP_PATH = os.path.join(BACKUP_PATH, 'EventGhost')
APPDATA_BACKUP_PATH = os.path.join(BACKUP_PATH, 'AppData', 'EventGhost')
PROGRAMDATA_BACKUP_PATH = os.path.join(BACKUP_PATH, 'ProgramData', 'EventGhost')


if os.path.exists(BACKUP_PATH):
    print 'There is already a folder named EventGhost_Backup on your desktop.'
    eg.Exit()
    
os.mkdir(BACKUP_PATH)
os.mkdir(os.path.split(APPDATA_BACKUP_PATH)[0])
os.mkdir(os.path.split(PROGRAMDATA_BACKUP_PATH)[0])


CORE_SOURCE_PATH = eg.mainDir
APPDATA_SOURCE_PATH = eg.configDir
PROGRAMDATA_SOURCE_PATH = os.path.split(eg.localPluginDir)[0]
TREE_SOURCE_FILE = eg.config.autoloadFilePath

if TREE_SOURCE_FILE is not None:
    os.path.split(TREE_SOURCE_FILE)[1]
    TREE_BACKUP_FILE = os.path.join(BACKUP_PATH, os.path.split(TREE_SOURCE_FILE)[1])
    shutil.copy(TREE_SOURCE_FILE, TREE_BACKUP_FILE)
    
shutil.copytree(CORE_SOURCE_PATH, CORE_BACKUP_PATH)
shutil.copytree(APPDATA_SOURCE_PATH, APPDATA_BACKUP_PATH)
shutil.copytree(PROGRAMDATA_SOURCE_PATH, PROGRAMDATA_BACKUP_PATH)

Once the script is pasted in place. click on the Apply button. then click on the test button.
This is going to backup all of EventGhost including all save files and configuration data as well as plugins.
It is going to place everything into a folder on your desktop called EventGhost_Backup

close EventGhost

If the backup was successful (no red errors in the log).
Go to Control Panel\Add Remove Programs.
Uninstall EventGhost.

Open Windows Explorer (File Explorer) in the bar at the top (address bar) type in

Code: Select all

%appdata%
and press enter.
Delete the folder named EventGhost

Then in the address bar type in

Code: Select all

%programdata%
and press enter.
delete the folder EventGhost.

Then in address bar type in

Code: Select all

%temp%
and press enter.
Check and see if there are these folders in there comtypes_cache or gen_py. if either one or both is in there delete them.


This is going to insure a super clean installation of EG.
Now install the latest build you downloaded when you clicked on the build button.

run a command prompt as Administrator (click on start. in the search field type in cmd. when it finds it. right click on it and select run as administrator).
Once you have the command prompt open i want you to type in the following

Code: Select all

"c:\Program Files (x86)\EventGhost\EventGhost.exe" -debug
Make sure it is exactly as you see above.

if you get the error when EventGhost runs
i want you to close EventGhost.
Open Windows Explorer. and type in the following into the address bar.

Code: Select all

%appdata%\EventGhost
there is going to be a file called log.txt. Send me a PM with this file attached.
You are going to have to change the extension or zip it to send it in a PM.

If you do not get the error Do the same as above except DO NOT run the command prompt as administrator.

Let me know if the error does not occur when you run EventGhost as an administrator
If you like the work I have been doing then feel free to Image

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Fri May 04, 2018 10:47 am

thx, for the instructions.
Have made a clean installation and aadmin debug log and sent you a PM.

pOpY

User avatar
kgschlosser
Site Admin
Posts: 4179
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: pythoncom error: Unexpected gateway error

Post by kgschlosser » Fri May 04, 2018 1:28 pm

ok so this is only going to work properly if you use the latest release candidate. or my suggestion would be to use the build you just downloaded and installed.

There is no need to have a Windows COM object for EventGhost. The COM object only exposed the following abilities

BringToFront - show EventGhost
InstallPlugin - install a plugin
OpenFile - open a save file
TriggerEvent - trigger an event

The reason why this was implemented is this was the mechanism that EventGhost used to send command line arguments to an already running copy of EventGhost. Since the COM object provided no other abilities then those listed above there really is no need to have it. The named pipe runs much faster and we have exposed almost the whole of the EventGhost API with it. It is also far less complex. and it is typically less prone to strange behavior, we are still working on ironing out the bugs in the named pipe But for a few with very specific requirements it is causing an issue. Most people will not come across this problem. It is mainly directed at making a heap of connections all at the same time.


The attached file you will want to place into

Code: Select all

Program Files (x86)\EventGhost\eg\WinApi
there is already a file in there with the same name you are simply going to overwrite it. There is a couple of modification that also address another thing that I had noticed that could cause EventGhost to slow down if you deleted your temporary files on the computer. So this has been addressed in that wile as well

I strongly recommend running EventGhost 0.5 because you are running on Windows 10. There are several things that have been added to EG to make it work correctly in a Windows 10 environment.
Attachments
COMServer.py
(3.72 KiB) Downloaded 21 times
If you like the work I have been doing then feel free to Image

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Fri May 04, 2018 5:24 pm

thx a lot, will try to update my EG with file provided and report back.
Is it safe to update my old installation?
Because of the plugins?

Or is it better todo a clean install like described above, load the old config and copy just the needed plugins over?

thx
pOpY

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Fri May 04, 2018 5:35 pm

kgschlosser wrote:
Fri May 04, 2018 1:28 pm
ok so this is only going to work properly if you use the latest release candidate. or my suggestion would be to use the build you just downloaded and installed.

There is no need to have a Windows COM object for EventGhost. The COM object only exposed the following abilities

BringToFront - show EventGhost
InstallPlugin - install a plugin
OpenFile - open a save file
TriggerEvent - trigger an event

The reason why this was implemented is this was the mechanism that EventGhost used to send command line arguments to an already running copy of EventGhost. Since the COM object provided no other abilities then those listed above there really is no need to have it. The named pipe runs much faster and we have exposed almost the whole of the EventGhost API with it. It is also far less complex. and it is typically less prone to strange behavior, we are still working on ironing out the bugs in the named pipe But for a few with very specific requirements it is causing an issue. Most people will not come across this problem. It is mainly directed at making a heap of connections all at the same time.


The attached file you will want to place into

Code: Select all

Program Files (x86)\EventGhost\eg\WinApi
there is already a file in there with the same name you are simply going to overwrite it. There is a couple of modification that also address another thing that I had noticed that could cause EventGhost to slow down if you deleted your temporary files on the computer. So this has been addressed in that wile as well

I strongly recommend running EventGhost 0.5 because you are running on Windows 10. There are several things that have been added to EG to make it work correctly in a Windows 10 environment.
WOrks as it should for me and the issue is fixed!
Thanks a lot.

PS.: is the fix included in next builds?

pOpY

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Fri May 04, 2018 5:38 pm

Had an other error in the log which ill never had before:

Code: Select all

Task.Deactivated.Desktop
Task.Activated.EventGhost
Traceback (most recent call last) (WIP-2018.04.15-22.52.17):
  File "wx\_core.pyc", line 16766, in <lambda>
  File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\__init__.py", line 780, in UpdateRatio
    self.ratio = float(t_val) / float(l_val)
ZeroDivisionError: float division by zero
Task.Deactivated.EventGhost
But EG runs.

pOpY

User avatar
kgschlosser
Site Admin
Posts: 4179
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: pythoncom error: Unexpected gateway error

Post by kgschlosser » Fri May 04, 2018 10:36 pm

I will push the code up for review. There are a few things I want to do because of other things that are in that file. the end game is that file is going to be removed completely. well I am hoping.


This error that you had is not the first time it has come up.

as far as the newest error you are having. Not sure why you are getting an error there. you can try this.

click on file then options. in the options dialog if the resize proportional is checked, uncheck it. if it is unchecked then check it.
If you like the work I have been doing then feel free to Image

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Sat May 05, 2018 10:26 am

kgschlosser wrote:
Fri May 04, 2018 10:36 pm
I will push the code up for review. There are a few things I want to do because of other things that are in that file. the end game is that file is going to be removed completely. well I am hoping.


This error that you had is not the first time it has come up.

as far as the newest error you are having. Not sure why you are getting an error there. you can try this.

click on file then options. in the options dialog if the resize proportional is checked, uncheck it. if it is unchecked then check it.
Looking forward to new releases :D

Regarding my error after double click the EG symbol in the taskbar.
I have unchecked the "resize Proportional" option (it was checked before).
Now the above issue is gone on this client.
Sadly, on EG start this time i have another error in the log:

Code: Select all

---> Willkommen beim EventGhost <---
Traceback (most recent call last) (WIP-2018.04.15-22.52.17):
  File "wx\_misc.pyc", line 1367, in Notify
  File "wx\_core.pyc", line 16873, in Notify
  File "wx\_core.pyc", line 16760, in CallAfter
  File "wx\_core.pyc", line 8427, in GetApp
PyAssertionError: C++ assertion "GetEventHandler() == this" failed at ..\..\src\common\wincmn.cpp(478) in wxWindowBase::~wxWindowBase(): any pushed event handlers must have been removed
I can "switch" betwenn the two errors:
  • when resie proportional is checked -> error from previous post (float)
  • when its unchecked -> error from this post
thx a lot for your support.

pOpY

User avatar
kgschlosser
Site Admin
Posts: 4179
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: pythoncom error: Unexpected gateway error

Post by kgschlosser » Sat May 05, 2018 2:43 pm

Do you have another computer that is running Windows 10? If so does it or can it have EG installed on to it? I want to know if it is experiencing the same issues.


also are you running EG with a completely empty configuration tree?
If you like the work I have been doing then feel free to Image

User avatar
topix
Experienced User
Posts: 413
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: pythoncom error: Unexpected gateway error

Post by topix » Sun May 06, 2018 8:03 am

Can you please attach here or PM your EventGhost config file? %APPDATA%\EventGhost\config.py

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Sun May 06, 2018 9:01 am

kgschlosser wrote:
Sat May 05, 2018 2:43 pm
Do you have another computer that is running Windows 10? If so does it or can it have EG installed on to it? I want to know if it is experiencing the same issues.


also are you running EG with a completely empty configuration tree?
topix wrote:
Sun May 06, 2018 8:03 am
Can you please attach here or PM your EventGhost config file? %APPDATA%\EventGhost\config.py
Ok guys, ill figured out whats the issue.
My Eventghost.lnk shortcut in: C:\Users\[USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
was set to "Minimized". This caused the issue!
Also when ill manually closed and restarted EG with this link, the issue was reproducable.
Maybe you can look into it?

Nevermind, i'll deleted the shortcut, restarted EG manually, checked "Start with windows" -> the shortcut gets recreated with some options (-h -e ...). Now when ill manuylly start EG, it starts minimized (because of -h) and teh issue is gone!

But sadly now i am facing anothe issue, that EG does'nt start with windows at all.
But the shortcut in Startup is there! Also when ill manually click the same shortcut, EG starts normally!?

It seems i am facing this issue now:

viewtopic.php?t=8034
viewtopic.php?f=2&t=7446&p=37537#p37537

I am here to debug if you want.

pOpY

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Sun May 06, 2018 10:01 am

Have solved my autostart issue.
EG is creating the shortcut in: C:\Users\[USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
But ill had to put it in: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
Dont know why.
The next thing which prevented EG from start was the set compatibility mode for the shortcut.
EG sets this to "Windows XP (SP3)" as default (it was so in my case).
Ill had to uncheck "run program in compatiblity mode" and finally my EG starts without an exception.
Also no exception when double click the taskbar icon.

The main issue of my exceptions was to selected "minimized" as startup option in the shortcut.
Maybe you can reproduce and fix the issue?

thx
pOpY

User avatar
kgschlosser
Site Admin
Posts: 4179
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: pythoncom error: Unexpected gateway error

Post by kgschlosser » Sun May 06, 2018 3:46 pm

OK cool. thanks for reporting and solving these bugs for us. we will check it out to confirm the issue.

One of the things you have to remember as well. if you run EventGhost as an administrator any changes you make do not get made for the user you are logged into the computer with. instead they get made for the Administrator user.

I wanted to throw that out there. I personally do not run Windows 10 (to many problems, and it's an overstuffed cow), But i will have someone that works on the project that does investigate it further.
If you like the work I have been doing then feel free to Image

popy
Posts: 24
Joined: Tue Mar 24, 2009 8:40 pm

Re: pythoncom error: Unexpected gateway error

Post by popy » Sun May 06, 2018 7:02 pm

thx for looking into it.
Keep up the good work

pOpY

Post Reply