Kodi Community Forum

Full Version: Error Contents: name 'typedinone' is not defined
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good Evening community,

Could someone please give me a hand with this.
import os
import xbmc
import xbmcgui
import zipfile
import shutil
import time
import datetime
import smtplib

def nam():
    name = xbmc.Keyboard('', 'Please type in your name')
    typedinone = name.getText()

def wd():
    weekday = xbmc.Keyboard('', 'Now type a day of the week')
    typedintwo = weekday.getText()

def clor():
    colo = xbmc.Keyboard('', 'And Finally type in a colour')
    typedinthree = colo.getText()

now = datetime.datetime.now()
runtime = now.strftime("%Y-%m-%d %H:%M")

#not sure what to do with these
#content1 = xbmc.executebuiltin('typedinone.getText()')
#content2 = xbmc.executebuiltin('typedintwo.getText()')
#content3 = xbmc.executebuiltin('typedinthree.getText()')

nam() , wd() , clor()

mailserver = smtplib.SMTP("smtp.mail.yyy",587)
mailserver.login('[email protected]','somepwd')
mailserver.sendmail('[email protected]','[email protected]', typedinone + ' on  ', + typedintwo + 'whos favourite colour is', + typedinthree + 'at', + runtime)
#Notification Of sent Email
xbmc.executebuiltin("Notification(Thankyou for helping me with this, message sent,()")

I Am aware all the mail stuff is made up, Ill fill in the blanks later on. But Im getting
typedinone is not defined.
Im guessing that its because its in a function. How would I pull the information out of the function and insert in the message
to be sent to myself.
def nam():
    keyboard = xbmc.Keyboard('', 'Please type in your name')
    if ( keyboard.isConfirmed() ):
        text = keyboard.getText()
        return text

typedinone = nam()
Hi Ronie,

Thanks a lot, All sorted. Nice one.