I am in the process of programming a simple org-mode diary which invokes emacs on a file in the form ddmmyyyy.org. It currently works. I changed a function which got which operation you wished (edit export del search quit) to error check the input. It is as follows:
def getOperation():
operation=input(“\nOperation: edit export del search quit\n\n”)
if operation.lower()==‘edit’ or operation.lower()==‘export’ or operation.lower()==‘del’ or operation.lower()==‘search’ or operation.lower()==‘quit’:
return(operation)
else:
maketitle()
getOperation()
when it returns “operation”, it hits:
if operation.lower()!=‘search’ and operation.lower()!=‘quit’ and operation.lower()!=‘’:
getdiary()
(which gets the date you wish to work with and invokes emacs)
the above works fine, my original code (which did not work (see following comments):
def getOperation():
operation=input(“\nOperation: edit export del search quit\n\n”)
if not operation.lower()==‘edit’ or operation.lower()==‘export’ or operation.lower()==‘del’ or operation.lower()==‘search’ or operation.lower()==‘quit’:
maketitle()
getOperation()
else:
return(operation)
when it returns “operation”, it hits:
if operation.lower()!=‘search’ and operation.lower()!=‘quit’ and operation.lower()!=‘’:
getdiary()
The top code works and is current. The lower variant, which adds nothing but the not and reverses the if / else
1.) only works if the operation is “edit”. All the other terms blank the screen and start the operation choice over ( the “else” part of the top code) AND only if the “edit” is the first try. If you enter “search”, “delete”, etc it blanks the screen and wants you to reenter your choice. If you enter “edit” on the first choice the diary functions. If you enter anything else and then “edit” on the second if you get an error like "NoneType does not have property “lower”.
Like I said, top code works, but “WT ______”. I am at a loss to explain the behavior.
Thanks
Swgeek