Technical discussions | Discussions techniques
Subscription date : 28 October 2009
Messages : 415
|
Hello there,
I'm working on an applet from scratch (that'll be the next facebook applet too, but now i'm starting with Gmail, yes i know there is already an applet for that, but i just want to do it anyway), i call it "Gossip".
I basically created the applet by copy-pasting the working Facebook applet to a another folder, renamed the files, edited the auto-load and conf files etc. The folder name == script name (without extension). When i start the applet though (from command line) i get sh: ./Gossip: Permission denied
Why is that? Any ideas?
Here is the code so far:
from BeautifulSoup import BeautifulSoup
from CDApplet import CDApplet
import gmailgossip
class Gossip(CDApplet):
''' This is the applet class inheriting from the standard CDApplet. '''
def __init__(self):
self.checkGmail = bool
CDApplet.__init__(self)
def get_config(self):
self.checkGmail = True
gmailAccount = AtomFeedMail()
gmailAccount.setupAccount('myusername', '**********')
def begin(self):
if self.checkGmail == True:
count = gmailAccount.checkMail()
print "...Gossip: you have", count, "unread email(s)."
class AtomFeedMail(object):
''' This class is used for Gmail, it represents an atom feed email account. '''
def __init__(self):
__username = str
__password = str
__xml = str
__count = int
object.__init__(self)
def setupAccount(self, username, password):
self.__username = username
self.__password = password
def provideAccount(self):
account = (self.__username, self.__password)
return account
def setXml(self):
data = gmailgossip.requestGmail(self.provideAccount)
if data:
self.__xml = data.read()
else:
self.__xml = ''
def checkMail(self):
self.setXml()
if len(self.__xml) > 0:
soup = BeautifulSoup(self.__xml)
self.__count = int(soup.fullcount.string)
else:
return -1
return self.__count
if __name__ == '__main__':
gossip = Gossip()
gossip.run()
|
matttbe, Wednesday 04 May 2011 à 02:25
|
|
Subscription date : 28 October 2009
Messages : 415
|
matttbe : [it] is a good idea to create a dedicated applet for only one task ... if it's an applet for GMail, why don't you name it "GMail"?
The applet should read not only Gmail, but every mail / micro-blogging services. I start with Gmail cause it's clean and easy. Will extend with Facebook etc.
matttbe : you can't execute it because of permission denied. In other words, you don't have the right to launch it so simply add the right to execute it by right clicking on your file or by launching this command:
Ha, that was simple indeed
matttbe : why do you use BeautifulSoup and not python-libxml2 or another XML parser? (it's maybe better to use the most used parser => if it's installed in most distribution by default, it's maybe better for the user...)
Good point, i just discovered BS, i will look at libxml2. BS was incredibly easy to use, except i had to install it. I hope libxml2 is that easy too |
matttbe, Wednesday 04 May 2011 à 07:33
|
|
Subscription date : 24 January 2009
Messages : 12573
|
BS was incredibly easy to use, except i had to install it. You can also copy it into the forlder of your applet but it's not recommended!
The applet should read not only Gmail, but every mail / micro-blogging services. I start with Gmail cause it's clean and easy. Don't hesitate to look at this application: CloudSN
|
Technical discussions | Discussions techniques
|