Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Help, Error on start up

If you have a question or need help, this is the place to be.
Post Reply
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Help, Error on start up

Post by mpg732 »

I need a bit of help. I haven't made any changes to EG for some time,but I now get some errors on start up. I can not figure out what might be causing thiese errors
Error compiling script.
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 121, in SetArguments
self.compiled = self.executable.Compile(*args)
File "C:\Program Files (x86)\EventGhost\plugins\EventGhost\PythonScript.py", line 71, in __init__
self.PrintTraceback()
File "C:\Program Files (x86)\EventGhost\plugins\EventGhost\PythonScript.py", line 97, in PrintTraceback
treeItem.PrintError("Traceback (most recent call last):")
AttributeError: 'NoneType' object has no attribute 'PrintError'


these errors appear in the log before the "autostart" in the log.

Every thing that I have running in EEG seems to be running fine, but not sure why I'm getting errors.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Help, Error on start up

Post by krambriw »

Tried to run EG with admin rights?
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Re: Help, Error on start up

Post by mpg732 »

Thanks, but that did not help. Still get the error. Just to clarify. The errors are the very first thing in the log.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Help, Error on start up

Post by krambriw »

Is EG starting correctly with an empty configuration?

Try the following:
- close EG
- with explorer, find your configuration xml file in your file system and rename it
- start EG

If EG starts, something could be wrong in your configuration. I would try to open the xml file in an editor like Notepad++ and check the syntax to try to see if anything looks damaged

Not so easy, I know but...
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Help, Error on start up

Post by kgschlosser »

That error is caused by 1 of 2 things. if You can remember the last plugin you installed, uninstall it and see if that fixes the problem. or it could also be an error in a python script you made. the error makes me believe it's the latter of the 2 because of the filename it is saying there is an error in. but usually it will tell you a script number the error is associated with. and you can locate more information on the exact script by looking through the config xml file. I wish the error was more specific and named the macro and the script name but it does not. it's a hunt and peck process to track that one down.


K
If you like the work I have been doing then feel free to Image
MMcCubbing
Posts: 1
Joined: Sun Nov 01, 2015 1:10 am

Re: Help, Error on start up

Post by MMcCubbing »

Thank you, guys! I was getting the same error for the last while, but everything was working correctly. Turns out it was an old, disabled script hidden away in one of my folders that was causing it!
User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: Help, Error on start up

Post by Luca Brasi »

Hey guys,

I got the same error for quite some time now. I deleted all plugins not needed and all old scripts in a dump folder to no avail. My config is over 6000 lines so it's pretty hard to check that manually. Do you have any clue for what I should search in the config on basis of my error?

Code: Select all

08:26:10   Error compiling script.
08:26:10   Traceback (most recent call last) (1722):
08:26:10     File "C:\PROGRA~2\EVENTG~1\eg\Classes\ActionItem.py", line 121, in SetArguments
08:26:10       self.compiled = self.executable.Compile(*args)
08:26:10     File "C:\PROGRA~2\EVENTG~1\plugins\EventGhost\PythonScript.py", line 71, in __init__
08:26:10       self.PrintTraceback()
08:26:10     File "C:\PROGRA~2\EVENTG~1\plugins\EventGhost\PythonScript.py", line 97, in PrintTraceback
08:26:10       treeItem.PrintError("Traceback (most recent call last):")
08:26:10   AttributeError: 'NoneType' object has no attribute 'PrintError'
08:26:10   Error compiling script.
08:26:10   Traceback (most recent call last) (1722):
08:26:10     File "C:\PROGRA~2\EVENTG~1\eg\Classes\ActionItem.py", line 121, in SetArguments
08:26:10       self.compiled = self.executable.Compile(*args)
08:26:10     File "C:\PROGRA~2\EVENTG~1\plugins\EventGhost\PythonScript.py", line 71, in __init__
08:26:10       self.PrintTraceback()
08:26:10     File "C:\PROGRA~2\EVENTG~1\plugins\EventGhost\PythonScript.py", line 97, in PrintTraceback
08:26:10       treeItem.PrintError("Traceback (most recent call last):")
08:26:10   AttributeError: 'NoneType' object has no attribute 'PrintError'
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Help, Error on start up

Post by kgschlosser »

this error is generated from one of the python scripts or python commands you have in your tree.

most commonly this will occur when punctuation is missing from a tuple or a dict and it's normally something really tiny.
what you can do is open each python script one at a time. and click the test button. upon clicking the test button the error will show that way you know what script caused the error.

or you can replace this file under the C:\Program Files (x86)\EventGhost\plugins\EventGhost folder. with the one i have attached

the file is PythonScript.py

this is a modified version of the core which gets ride of the traceback in the core and will tell you what the real traceback error is.

this will not tell you which python script it is. but i have it set so that it prints the line of code before the error through the line of code after the error along with the lines numbers and what the error is.

so that should aid greatly in finding the exact script doing it.

now it could be a file doing it. in that case let me know if you are unable to find a python script causing the error and i will see if i can have it spit out the filename also for you. i didn't want to do that because all python scripts are saved to a temp file and then loaded. so you would get some crazy filenames in the mix and i didn't want you to go hunting for something that may not be there.


but i have corrected this issue and the file is attached and you will want to download this version and drop it right into place overwriting the original


this is a band aid fix this happens because it is trying to get the tree item that caused the error but is unable to because the tree has not been created yet. the root of the problem exists because the script or command is being compiled before the tree is made. this process needs to be changed in order for the proper error to be printed indicating which item it is.

if you prefer editing your existing file then here the is code to look for and the code to replace it with

from line 95 to line line 124 of the PythonScript.py file has to be changed from this

Code: Select all

        def PrintTraceback(self):
            treeItem = eg.currentItem
            treeItem.PrintError("Traceback (most recent call last):")
            lines = self.sourceCode.splitlines()
            tbType, tbValue, tbTraceback = sys.exc_info()
            for entry in traceback.extract_tb(tbTraceback)[1:]:
                filename, linenum, funcname, source = entry
                filename = filename.decode('mbcs')
                try:
                    filenum = int(filename)
                except:
                    filenum = None
                if source is None and filenum is not None:
                    treeItem.PrintError(
                        '  Python script "%s", line %d, in %s' % (
                            filename, linenum, funcname
                        )
                    )
                    lines = self.scriptDict[filenum].sourceCode.splitlines()
                    treeItem.PrintError('    ' + lines[linenum-1].lstrip())
                else:
                    treeItem.PrintError(
                        '  File "%s", line %d, in %s' % (
                            filename, linenum, funcname
                        )
                    )
                    if source is not None:
                        treeItem.PrintError('    ' + source.lstrip())
            name = tbType if type(tbType) == type("") else tbType.__name__
            treeItem.PrintError(str(name) + ': ' + str(tbValue))
to this

Code: Select all

        def PrintTraceback(self):
            treeItem = eg if eg.currentItem is None else eg.currentItem
            treeItem.PrintError("Traceback (most recent call last):")

            lines = self.sourceCode.splitlines()
            sys_execinfo = sys.exc_info()
            tbType, tbValue, tbTraceback = sys_execinfo
            for entry in traceback.extract_tb(tbTraceback)[1:]:
                filename, linenum, funcname, source = entry
                filename = filename.decode('mbcs')
                try:
                    filenum = int(filename)
                except:
                    filenum = None
                if source is None and filenum is not None:
                    treeItem.PrintError(
                        '  Python script "%s", line %d, in %s' % (
                            filename, linenum, funcname
                        )
                    )
                    lines = self.scriptDict[filenum].sourceCode.splitlines()
                    treeItem.PrintError('    ' + lines[linenum-1].lstrip())
                else:
                    treeItem.PrintError(
                        '  File "%s", line %d, in %s' % (
                            filename, linenum, funcname
                        )
                    )
                    if source is not None:
                        treeItem.PrintError('    ' + source.lstrip())

            name = tbType if type(tbType) == type("") else tbType.__name__

            if not traceback.extract_tb(tbTraceback)[1:]:
                linenum = int(sys_execinfo[1][1][1])
                err = 'Python Script Error: ' + str(name) + '\n'
                err += 'Type: ' + str(sys_execinfo[1][0]) + '\n'
                err += 'Line    Code\n'
                err += '-' * 20 + '\n'
                if linenum-2 >= 0:
                    spaces = " " * (8 - len(str(linenum - 1)))
                    err += '  ' + str(linenum - 1) + spaces + lines[linenum-2] + '\n'
                spaces = ' ' * (8 - len(str(linenum)))
                err += '*' + str(linenum) + spaces + lines[linenum-1] + '\n'
                if linenum <= len(lines) - 1:
                    spaces = ' ' * (8 - len(str(linenum+1)))
                    err += '  ' + str(linenum+1) + spaces + lines[linenum] + '\n'
                eg.PrintError(err)
            else:
                treeItem.PrintError(str(name) + ': ' + str(tbValue))
i am not sure how the indenting is done if it's spaces or tabs. so if you get an indent error then you might have to convert the file to indent with spaces or tabs whichever you prefer

now this will not tell you which python script it is. but i have it set so that it prints the line of code before the error through the line of code after the error along with the lines numbers and what the error is.

so that should aid greatly in finding the exact script doing it.

now it could be a file doing it. in that case let me know if you are unable to find a python script causing the error and i will see if i can have it spit out the filename also for you. i didn't want to do that because all python scripts are saved to a temp file and then loaded. so you would get some crazy filenames in the mix and i didn't want you to go hunting for something that may not be there.


K
Attachments
PythonScript.py
(5.45 KiB) Downloaded 121 times
If you like the work I have been doing then feel free to Image
User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: Help, Error on start up

Post by Luca Brasi »

kgschlosser you're the man! Thank you so much for your help and the great deal of time you put in your response and the alternate file!
It gave me this:

Code: Select all

09:18:22   Error compiling script.
09:18:22   Traceback (most recent call last):
09:18:22   Traceback (most recent call last) (1722):
09:18:22     File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 121, in SetArguments
09:18:22       self.compiled = self.executable.Compile(*args)
09:18:22     File "C:\Program Files (x86)\EventGhost\plugins\EventGhost\PythonScript.py", line 71, in __init__
09:18:22       self.PrintTraceback()
09:18:22     File "C:\Program Files (x86)\EventGhost\plugins\EventGhost\PythonScript.py", line 128, in PrintTraceback
09:18:22       linenum = int(sys_execinfo[1][1][1])
09:18:22   IndexError: tuple index out of range
09:18:22   Error compiling script.
09:18:22   Traceback (most recent call last):
09:18:22   Python Script Error: IndentationError
09:18:22   Type: expected an indented block
09:18:22   Line    Code
09:18:22   --------------------
09:18:22     6           #eg.plugins.System.Execute(u'D:\\Programmdaten\\01_Zentral\\Scripts\\mmhtpc\\Pskill\\pskill_kodi.bat', u'', 3, False, 3, u'', False, False, u'', False, False, False)
09:18:22   *7       if eg.globals.mp_running:
09:18:22     8           #eg.plugins.System.Execute(u'D:\\Programmdaten\\01_Zentral\\Scripts\\mmhtpc\\Pskill\\pskill_mediaportal.bat', u'', 3, False, 3, u'', False, False)
09:18:22   
With that I could find some scripts where I commented out some lines inside of a if statement. The scripts ran fine and tested well though. But as soon as I got rid of the # the errors for that disappeared and now I'm left with the last error about a tuple:

Code: Select all

09:45:41   Error compiling script.
09:45:41   Traceback (most recent call last):
09:45:41   Traceback (most recent call last) (1722):
09:45:41     File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 121, in SetArguments
09:45:41       self.compiled = self.executable.Compile(*args)
09:45:41     File "C:\Program Files (x86)\EventGhost\plugins\EventGhost\PythonScript.py", line 71, in __init__
09:45:41       self.PrintTraceback()
09:45:41     File "C:\Program Files (x86)\EventGhost\plugins\EventGhost\PythonScript.py", line 128, in PrintTraceback
09:45:41       linenum = int(sys_execinfo[1][1][1])
09:45:41   IndexError: tuple index out of range
Honestly I wasn't aware that I am using a tuple somewhere. I was only aware of using lists :-) I'll have to investigate into that later. If you got any hints how to do that the easiest way I'll be grateful.

Thanks again!!
Luca
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Help, Error on start up

Post by kgschlosser »

i was just using that as an example. but a list is basically the same thing just not mutable. normally it's from a syntax error. a coding error caused by something small like punctuation that is not a jump right out and slap ya kind of a problem. that's all i'm getting at.


i have also spent some time last night and i will finish it up this evening. but i deep sixed the python script editor. and i upgraded it. made it more like a code editor instead of just a plain ol text edit box.

it allows for code completion, searching, shows errors for indent mistakes as well as those crafty punctuation errors. allows for color coding the various pieces of python syntax. it will highlight for correct bracketing and also highlights for incorrect brackets. shows errors for not closing quotes single or double. has over 10000 different python functions for the code complete. has line numbers and code folding.

here is a list of all of the options that the user will be able to set. i am also going to have a couple of "theme" buttons for the user to make it a little easier.


all options below will have the ability to select
font, font style, font size, font color, background color
except the ones that have specific choices next to them

white space
comments
comment block
numbers
single quotes
double quotes
triple single quotes
triple double quotes
keywords
user definable keywords (future use)
class names
def names
operators
identifiers
missing quotes (text color and background color up to where the missing quote is, and then the background color for the remainder of the line)
decorators
line numbers
control characters
brace correct
brace incorrect
caret (color)
code folding (foreground color, background color)


code folding options

use code folding (enable or disable)
folding commented lines (enable or disable)
folding quoted lines (enable or disable)
folding icon styles to choose (arrows, plus minus, circled plus minus, boxed plus minus)


misc options

error for Incorrect indent (ignore, inconsistent, mixed spaces/tabs, spaces are bad, tabs are bad)
view indent guides (yes or no)
indent spaces (number of spaces to use for indents)
back space deletes indents (yes or no) this if so that instead of deleting an indent one space at a time it will delete the defined number of spaces
editor margins, (2 numbers one for top/bottom and one for right-left)
view white space markers (yes or no)
zoom in key (keyboard key to use for zoom in)
zoom out key (keyboard key to use for zoom out)


K
If you like the work I have been doing then feel free to Image
Post Reply