exceptions Indentation Error
#1
Hello all,

I have recently written myself a little script that will notify the user when you receive a new email.
The script works fine but when i try to notify the user then it returns an error.

Here is the error that it logged in to the xbmc.txt :

PHP Code:
Error Type: <type 'exceptions.IndentationError'>
                                            
Error Contents: ('expected an indented block', ('C:\\Users\\Xbox\\AppData\\Roaming\\XBMC\\addons\\skin.xbox\\system\\EmailNotify.py'240"xbmc.executebuiltin('XBMC.Notification(Snufflylake You ,have an unread message)')\n"))
                                            
IndentationError: ('expected an indented block', ('C:\\Users\\Xbox\\AppData\\Roaming\\XBMC\\addons\\skin.xbox\\system\\EmailNotify.py'240"xbmc.executebuiltin('XBMC.Notification(Snufflylake You ,have an unread message)')\n")) 

And here is how i tried to notify the user from the python script :

PHP Code:
xbmc.executebuiltin('XBMC.Notification(Snufflylake You ,have an unread message)'

My python skills aren't too good at the moment, so it may be a very simple mistake.

Any help would be much appreciated!

Thanks.
Reply
#2
Indentation error basically means that that line of code is indented inconsistently with the rest of your code.

If it looks like it is indented properly check you haven't mixed spaces and tabs.

Or maybe an empty if/while/for statement?

Post the code above that line so we can see the context.
Reply
#3
I think we'll need to see the rest of the code so we can see what the indentation should be.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#4
Thanks for the quick reply!

Here is a copy of the whole script :

PHP Code:
import xbmc
import sys
winsound
#Here, we import modules needed for this program
newEmail=""
USERNAME xbmc.getInfoLabel'$INFO[Skin.string(MyEmail)]' )
PASSWORD xbmc.getInfoLabel'$INFO[Skin.string(MyPassword)]' )
PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom"
#We assign variables with values. Fill in your username and password
def mail(checker):
    
email int(feedparser.parse(
        
PROTO USERNAME ":" PASSWORD "@" SERVER PATH
    
)["feed"]["fullcount"])
#parses your account data and sends it to gmail
    
if email 0:
        
newEmail 1
    
else:
        
newEmail 0
    
#checks for mail

    
if newEmail==1:
xbmc.executebuiltin('XBMC.Notification(Snufflylake You ,have an unread message)')

#notify user if email present 
Reply
#5
you need to indent it

PHP Code:
if newEmail==1:
        
xbmc.executebuiltin('XBMC.Notification(Snufflylake You ,have an unread message)'
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#6
Thanks man! it's working perfectly now.
Reply

Logout Mark Read Team Forum Stats Members Help
exceptions Indentation Error0