Help with an error

If you have a question or need help, this is the place to be.

Help with an error

Postby molitar » Tue Feb 21, 2012 5:26 am

I have a piece of code to split text and it has worked for a long time now all of a sudden it has stopped functioning. Maybe a Windows Update broke it I do not know but I really need someones help with this issue.

Traceback (most recent call last):
Python script "38", line 31, in <module>
secArray = elaps.split(':')
AttributeError: 'NoneType' object has no attribute 'split'

Code: Select all
import re

mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
hWnd = mpc()

if len(hWnd) > 0:
    from eg.WinApi import GetWindowText
    title = GetWindowText(hWnd[0])
    if re.search(".mkv",title,re.I):
        title = title.split(".mkv")[0]
    elif re.search(".mp4",title,re.I):
        title = title.split(".mp4")[0]
    elif re.search(".avi",title,re.I):
        title = title.split(".avi")[0]
    elif re.search(".ogm",title,re.I):
        title = title.split(".ogm") [0]
    else:
        title = title.split(".")[0]
       
elaps, rem, total = eg.plugins.MediaPlayerClassic.GetTimes()
#print "elaps, rem, total =",elaps, rem, total

x = 1

while x < 4:

    if elaps != "00:00:00":
        if eg.globals.WindowsState == "Fullscreen": howManyBars = 100
        if eg.globals.WindowsState != "Fullscreen": howManyBars = 100

        secArray = elaps.split(':')
        secArrayTotal = total.split(':')
       
        secondsTotal = int(secArrayTotal[0])*(3600)+int(secArrayTotal[1])*(60)+int(secArrayTotal[2])
        secondsElapsed = int(secArray[0])*(3600)+int(secArray[1])*(60)+int(secArray[2])
       
        percent = (1.0*secondsElapsed)/(secondsTotal)*100
        percent = int(round(percent))
        bars = (percent * howManyBars)/100

        #print "percent =",percent
        #print "bars =",bars
       
        osd = title + "\n \n" + "[ " + "|" * bars + " " * (howManyBars - bars) + " ]" + "\n" + " "*30 + elaps + " / " + total

        if eg.globals.WindowsState <> "Fullscreen":
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 1, 1.0, False)
        else:
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 0, 1.0, False)
    eg.Wait(0.8)
    #print x
    x += 1
molitar
Experienced User
 
Posts: 149
Joined: Fri Sep 11, 2009 6:44 am

Re: Help with an error

Postby Dragon470 » Fri Mar 02, 2012 1:34 am

I just tried to make a script to split a message from the google voice plugin, and am getting the same error. AttributeError: 'NoneType' object has no attribute 'split'. I also updated eg when I noticed the error. The error still is there. Have you or anyone figured out why this is, or more importantly how to fix it?
Dragon470
 
Posts: 24
Joined: Thu Feb 10, 2011 2:16 am

Re: Help with an error

Postby molitar » Fri Mar 02, 2012 3:46 am

Found the problem to be for some reason the result was not passing so it could not split the name. I uninstalled latest window updates at time it happened and rebooted and everything was again working fine so maybe a windows update caused this to happen.
molitar
Experienced User
 
Posts: 149
Joined: Fri Sep 11, 2009 6:44 am


Return to General Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Google Adsense [Bot] and 3 guests