From subhodipbiswas at gmail.com Thu Dec 1 19:49:56 2011 From: subhodipbiswas at gmail.com (Subhodip Biswas) Date: Fri, 2 Dec 2011 00:19:56 +0530 Subject: [BangPypers] Some weird issues even though apparently the syntax is correct. Message-ID: Hi all, I got stuck on something very basic and google search reveals that I am syntactically correct but still I am facing some issues. Issue 1 : Class someclassname: def method1(self, a) . . return s def method2(self, s) . print someoperationon(s) if __name__ == '__main__': a = somedata x = someclassname() method2(*method1(a).s) I get an error stating that my someclassname() is not defined. Issue 2: if __name__ == '__main__': a = somedata x = method1(a) y = method2(x.s) print y.someresult. Debugging reveals that the data in s becomes nonetype during the flow(so print y.someresult is also nonetype in the end). I am sure I am missing out something very silly here but catch the cat. Please help me in finding where I am going wrong here. ------------- Regards Subhodip Biswas GPG key : FAEA34AB Server : pgp.mit.edu http://subhodipbiswas.wordpress.com From lawgon at gmail.com Fri Dec 2 07:17:03 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Fri, 02 Dec 2011 11:47:03 +0530 Subject: [BangPypers] Some weird issues even though apparently the syntax is correct. In-Reply-To: References: Message-ID: <1322806626.8537.62.camel@xlquest.web> On Fri, 2011-12-02 at 00:19 +0530, Subhodip Biswas wrote: > Debugging reveals that the data in s becomes nonetype during the > flow(so print y.someresult is also nonetype in the end). I am sure I > am missing out something very silly here but catch the cat. Please > help me in finding where I am going wrong here. it would be nice if you posted the actual code you used (even if you are working for the CIA I am sure they won't mind) -- regards Kenneth Gonsalves From kadambari.devarajan at gmail.com Fri Dec 2 20:06:49 2011 From: kadambari.devarajan at gmail.com (Kadambari Devarajan) Date: Sat, 3 Dec 2011 00:36:49 +0530 Subject: [BangPypers] [ANN] [X-Post] Call for Participation - SciPy.in 2011 (Dec 4 - 7; IIT Bombay) Message-ID: Hi everyone, It's that time of the year again and SciPy.in is just about to start. Please find below Prabhu Ramachandran's blog postinviting everyone interested to the conference. ------- If you aren't aware of it yet, SciPy.in 2011 is just round the corner. This year it is going to be held at IIT Bombay's new Victor Menezes Convention Center (VMCC). We have conference talks on 4th and 5th and tutorials on 6th and 7th . We have invited several key peoplefrom the "Scientific Computing with Python" community. We have an awesome set of talks and tutorials . Eric Jones from Enthought is our keynote speaker. In 2009 and 2010 we did workshops on basic scientific computing with Python. This year our tutorial track features several advanced topicsincluding, image processing, machine learning, symbolic computing, mapping and geoprocessing, Traits/TraitsUI, Mayavi, Sage, and Cython. If you wish to participate in the conference, feel free to drop in and attend, free of cost -- but you'll miss out on the awesome food, t-shirt, and other goodies if you do not register. It would be best if you didregisterthough. The main organizers of SciPy.in 2011 are FOSSEE . Enthought (India) is also helping organize the conference. MHRD and Enthought are our financial sponsors and we are grateful to them for their continued support. Given the nature of the talks, the tutorials, the location, you are going to miss out if you choose to not attend. Register before 2nd to avail of reduced rates. Spot registration is certainly available but is more expensive. ------- I don't have much to add! Hope to see some folks from the different communities here :) Cheers, KD -- Webpage - http://kadambarid.in From smrutilekha at gmail.com Mon Dec 5 05:21:25 2011 From: smrutilekha at gmail.com (Smrutilekha Swain) Date: Mon, 5 Dec 2011 09:51:25 +0530 Subject: [BangPypers] Query abt QTableWidgetItem In-Reply-To: References: Message-ID: Thanzzzzzzzzz..........i have tried dat n got hte result..... but i have another 2 problems... i have assigned 3 values for each column of the table but it just gets updated on that particular cell i.e., item = self. lineEdit.text() self.tableWidgetItem.setText(item) self.table.setItem(1,0,self.tableWidgetItem) item1 = self. lineEdit1.text() self.tableWidgetItem.setText(item1) self.table.setItem(1,1,self.tableWidgetItem) but it is updating the value in row 1 and column 0 (both). how can i update each cell??? i have a QListwidget. i want to display the text whenever i opened the gui... plzzzzzzz answer my queries as soon as possible....Thanking You............. From smrutilekha at gmail.com Mon Dec 5 09:33:32 2011 From: smrutilekha at gmail.com (Smrutilekha Swain) Date: Mon, 5 Dec 2011 14:03:32 +0530 Subject: [BangPypers] Problem in filling the QTableWidget Message-ID: Hello everybody................... Thanzzzzzzzz 4 d help.......but now i need help....... i have a QListWidget which contains the list of ip address of the other pc. A QTablewidget which contains 5 columns - ip address(which will take from QListWidget), compare, similar, pass/fail(it is an Icon) and remarks. A pushButton which says RUN. On clicking the button all the data should update in the table i can update ip address row by row but rest of the column can't b updated. my code: def run(self): countRows = self.listWidget.count() for i in range(countRows): strItem = self.listWidget.item().text() self.tableWidgetItem = QTableWidgetItem() self.tableWidgetItem.setText(QString(strItem)) self.table.setItem(i,0,self.tableWidgetItem) str1 = QString("1") self.tableWidgetItem.setText(str1) self.table.setItem(i,1,self.tableWidgetItem) str1 = QString("2") self.tableWidgetItem.setText(str2) self.table.setItem(i,2,self.tableWidgetItem) self.tableWidgetItem.setIcon(QIcon(QPixmap("../Icons/tick.png))) self.table.setItem(i,3,self.tableWidgetItem) str1 = QString("4") self.tableWidgetItem.setText(str4) self.table.setItem(i,4,self.tableWidgetItem) but when i clicked the RUN button. the column of ip address displays correct data but in 2nd column it shows "4" n error "QTableWidget: can't read QTableWidgetItem that is owned by another QTableWidgetItem" Plzzzzzzzz help me........ASAP........Thanzzzzzzzzzz in advance.................... From vikas.bn at gmail.com Tue Dec 6 05:19:51 2011 From: vikas.bn at gmail.com (Vikas BN) Date: Tue, 6 Dec 2011 09:49:51 +0530 Subject: [BangPypers] ElementTree object instance evaluates to False? Message-ID: Hi All, ? ?I'm working on a script to parse XML files and am using cElementTree for the same. However, ? ?I was under the impression that anything that's a None type or 0 or "" would evaluate to False ? ?and the rest would be True (incl an instance of an object). ? ?That doesn't seem to work with the Element instance. Here's what I get : >>> import xml.etree.cElementTree as cet >>> f1 = '/home/vikasn/test.xml' >>> t1 = cet.parse(f1) >>>root = t1.getroot() >>> children = root.getchildren() >>> len(children) 3 >>> c1 = children[0] >>> if c1: ... print "true" ... else: ... print "false" ... false >>> c1 Because of this, I need to resort to clunky stuff like so: if c1.tag: # do something To test if my understanding of what evaluates to true/false is correct or not, I tried the following and seems to be what I expect would happen. >>> class Test(object): ... def __init__(self, num): ... print num ... self.num = num ... >>> t = Test(1) 1 >>> t <__main__.Test object at 0x2afb4507c610> >>> if t: ... print "yes" ... else: ... print "no" ... yes >>> Anyone else encountered this or even have any insights regarding this behaviour? I'm using Python2.7.2 on Linux if that matters. Thanks! Vikas From navin.kabra at gmail.com Tue Dec 6 05:24:32 2011 From: navin.kabra at gmail.com (Navin Kabra) Date: Tue, 6 Dec 2011 09:54:32 +0530 Subject: [BangPypers] ElementTree object instance evaluates to False? In-Reply-To: References: Message-ID: On Tue, Dec 6, 2011 at 9:49 AM, Vikas BN wrote: > ? ?I'm working on a script to parse XML files and am using > cElementTree for the same. However, > ? ?I was under the impression that anything that's a None type or 0 or > "" would evaluate to False > ? ?and the rest would be True (incl an instance of an object). Any object that has a __len__ defined will evaulate to False in a boolean context if __len__ returns 0. (See also __nonzero__). See section 5.1 here: http://docs.python.org/library/stdtypes.html I hope this answers your question. From vikas.bn at gmail.com Tue Dec 6 05:35:23 2011 From: vikas.bn at gmail.com (Vikas BN) Date: Tue, 6 Dec 2011 10:05:23 +0530 Subject: [BangPypers] ElementTree object instance evaluates to False? In-Reply-To: References: Message-ID: Hi Navin, On Tue, Dec 6, 2011 at 9:54 AM, Navin Kabra wrote: > On Tue, Dec 6, 2011 at 9:49 AM, Vikas BN wrote: >> ? ?I'm working on a script to parse XML files and am using > > Any object that has a __len__ defined will evaulate to False in a > boolean context if __len__ returns 0. (See also __nonzero__). > > See section 5.1 here: http://docs.python.org/library/stdtypes.html Thanks! That's it I think. >>> c1.__len__ Traceback (most recent call last): File "", line 1, in AttributeError: __len__ >>> len(c1) 0 So len(c1) is returning 0. But I don't undestand why __len__ is throwing an AttributeError. Time to read ElementTree docs I suppose. Thanks! Vikas From noufal at gmail.com Tue Dec 6 06:45:03 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 06 Dec 2011 11:15:03 +0530 Subject: [BangPypers] ElementTree object instance evaluates to False? In-Reply-To: (Vikas BN's message of "Tue, 6 Dec 2011 09:49:51 +0530") References: Message-ID: <8739cydzj4.fsf@sanitarium.localdomain> Vikas BN writes: [...] > Anyone else encountered this or even have any insights regarding > this behaviour? I'm using Python2.7.2 on Linux > if that matters. ElementTree's `Element` objects behave this way. The "booleanness" is not conformant to the rest of Python. I don't know if or when it's been fixed but here's how to do it. http://effbot.org/zone/element.htm#truth-testing The method you need to work with is `__nonzero__`[1] if you want `bool` to work with your classes. With Python 2.7.2, The `Element` class defined in /usr/lib/python2.7/xml/etree/ElementTree.py has def __nonzero__(self): warnings.warn( "The behavior of this method will change in future versions. " "Use specific 'len(elem)' or 'elem is not None' test instead.", FutureWarning, stacklevel=2 ) return len(self._children) != 0 # emulate old behaviour, for now So, it will evaluate to False only if the number of children is zero. Annoying but when I stumbled on this, it did make me aware of how consistent Python libraries generally are so that this stuck out. [...] Footnotes: [1] http://docs.python.org/reference/datamodel.html#object.__nonzero__ -- ~noufal http://nibrahim.net.in I am a deeply superficial person. -Andy Warhol From saager.mhatre at gmail.com Tue Dec 6 14:28:50 2011 From: saager.mhatre at gmail.com (Saager Mhatre) Date: Tue, 6 Dec 2011 18:58:50 +0530 Subject: [BangPypers] ElementTree object instance evaluates to False? In-Reply-To: <8739cydzj4.fsf@sanitarium.localdomain> References: <8739cydzj4.fsf@sanitarium.localdomain> Message-ID: Refer https://gist.github.com/1327614#file_truth.py to see if it helps any. - d On Tue, Dec 6, 2011 at 11:15 AM, Noufal Ibrahim wrote: > Vikas BN writes: > > [...] > > > Anyone else encountered this or even have any insights regarding > > this behaviour? I'm using Python2.7.2 on Linux > > if that matters. > > ElementTree's `Element` objects behave this way. The "booleanness" is > not conformant to the rest of Python. > > I don't know if or when it's been fixed but here's how to do it. > http://effbot.org/zone/element.htm#truth-testing > > The method you need to work with is `__nonzero__`[1] if you want `bool` > to work with your classes. > > With Python 2.7.2, The `Element` class defined in > /usr/lib/python2.7/xml/etree/ElementTree.py has > > def __nonzero__(self): > warnings.warn( > "The behavior of this method will change in future versions. " > "Use specific 'len(elem)' or 'elem is not None' test instead.", > FutureWarning, stacklevel=2 > ) > return len(self._children) != 0 # emulate old behaviour, for now > > So, it will evaluate to False only if the number of children is > zero. > > Annoying but when I stumbled on this, it did make me aware of how > consistent Python libraries generally are so that this stuck out. > > [...] > > Footnotes: > [1] http://docs.python.org/reference/datamodel.html#object.__nonzero__ > > -- > ~noufal > http://nibrahim.net.in > > I am a deeply superficial person. -Andy Warhol > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From aashutoshnarayan at gmail.com Wed Dec 7 07:48:02 2011 From: aashutoshnarayan at gmail.com (Ashutosh Narayan) Date: Wed, 7 Dec 2011 12:18:02 +0530 Subject: [BangPypers] virtual-python & easy_install doubt Message-ID: Hi, I am facing some issues w.r.t easy_install when I want to use virtual-python environment. I followed below mentioned link to set up virtual-python : http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python OS: SuSE Linux Enterprise Desktop Python version: 2.6 I edited PYTHONPATH to something like this : *>cat /etc/bash.bashrc.local * export PYTHONPATH=.:/home/ashutoshn/lib/:$PYTHONPATH export PATH=.:~/bin:/opt/local/bin:$PATH Then I install setuptools by executing : *> sh setuptools-0.6c11-py2.6.egg -d /home/ashutoshn/lib/* The system now uses easy_install of the virtual-python environment. *> which easy_install* /home/ashutoshn/lib/easy_install *>easy_install Pygments* *-d /home/ashutoshn/lib/python2.6/site-packages/* I get the following error message : *error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 2] No such file or directory: '/usr/local/lib/python2.6/site-packages/test-easy-install-27311.pth' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/local/lib/python2.6/site-packages/ This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir option)*. So, how does Python keep track of what directories are / are not enabled for *.pth* processing ? easy_install doesn't seem to work for me. Any suggestions / inputs ? Thank you, -- Ashutosh Narayan http://ashutoshn.wordpress.com From prataprc at gmail.com Wed Dec 7 08:20:07 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Wed, 7 Dec 2011 12:50:07 +0530 Subject: [BangPypers] virtual-python & easy_install doubt In-Reply-To: References: Message-ID: Can you try virtualenv ? You can download the virtualenv package and use `virtualenv` command like, > virtualenv --no-site-packages pluggd-env Of course you can replace `pluggd-env` with directory name that should contain your virtual python environment. After setting up the virtual environment, you can activate the virtual environment for you shell like, > source pluggd-env/bin/activate On Wed, Dec 7, 2011 at 12:18 PM, Ashutosh Narayan wrote: > Hi, > > I am facing some issues w.r.t easy_install when I want to use > virtual-python environment. > I followed below mentioned link to set up virtual-python : > > http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python > > OS: SuSE Linux Enterprise Desktop > Python version: 2.6 > > I edited PYTHONPATH to something like this : > > *>cat /etc/bash.bashrc.local * > > export PYTHONPATH=.:/home/ashutoshn/lib/:$PYTHONPATH > export PATH=.:~/bin:/opt/local/bin:$PATH > > Then I install setuptools by executing : > > *> sh setuptools-0.6c11-py2.6.egg -d /home/ashutoshn/lib/* > > The system now uses easy_install of the virtual-python environment. > > *> which easy_install* > > /home/ashutoshn/lib/easy_install > > *>easy_install Pygments* *-d /home/ashutoshn/lib/python2.6/site-packages/* > > I get the following error message : > > *error: can't create or remove files in install directory > > The following error occurred while trying to add or remove files in the > installation directory: > > ? ?[Errno 2] No such file or directory: > '/usr/local/lib/python2.6/site-packages/test-easy-install-27311.pth' > > The installation directory you specified (via --install-dir, --prefix, or > the distutils default setting) was: > > ? ?/usr/local/lib/python2.6/site-packages/ > > This directory does not currently exist. ?Please create it and try again, or > choose a different installation directory (using the -d or --install-dir > option)*. > > So, how does Python keep track of what directories are / are not enabled > for *.pth* processing ? > > easy_install doesn't seem to work for me. Any suggestions / inputs ? > > > Thank you, > -- > Ashutosh Narayan > > http://ashutoshn.wordpress.com > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. From aashutoshnarayan at gmail.com Wed Dec 7 08:48:13 2011 From: aashutoshnarayan at gmail.com (Ashutosh Narayan) Date: Wed, 7 Dec 2011 13:18:13 +0530 Subject: [BangPypers] virtual-python & easy_install doubt In-Reply-To: References: Message-ID: Yes, virtualenv is an extension of virtual-python. I can try that as well. But again my concern is why easy_install is not picking up the virtual environment that I have set to. Any pointers ? Thank you, - Ashutosh On Wed, Dec 7, 2011 at 12:50 PM, Pratap Chakravarthy wrote: > Can you try virtualenv ? You can download the virtualenv package and > use `virtualenv` command like, > > > virtualenv --no-site-packages pluggd-env > > Of course you can replace `pluggd-env` with directory name that should > contain your virtual python environment. > > After setting up the virtual environment, you can activate the virtual > environment for you shell like, > > > source pluggd-env/bin/activate > > > > On Wed, Dec 7, 2011 at 12:18 PM, Ashutosh Narayan > wrote: > > Hi, > > > > I am facing some issues w.r.t easy_install when I want to use > > virtual-python environment. > > I followed below mentioned link to set up virtual-python : > > > > > http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python > > > > OS: SuSE Linux Enterprise Desktop > > Python version: 2.6 > > > > I edited PYTHONPATH to something like this : > > > > *>cat /etc/bash.bashrc.local * > > > > export PYTHONPATH=.:/home/ashutoshn/lib/:$PYTHONPATH > > export PATH=.:~/bin:/opt/local/bin:$PATH > > > > Then I install setuptools by executing : > > > > *> sh setuptools-0.6c11-py2.6.egg -d /home/ashutoshn/lib/* > > > > The system now uses easy_install of the virtual-python environment. > > > > *> which easy_install* > > > > /home/ashutoshn/lib/easy_install > > > > *>easy_install Pygments* *-d > /home/ashutoshn/lib/python2.6/site-packages/* > > > > I get the following error message : > > > > *error: can't create or remove files in install directory > > > > The following error occurred while trying to add or remove files in the > > installation directory: > > > > [Errno 2] No such file or directory: > > '/usr/local/lib/python2.6/site-packages/test-easy-install-27311.pth' > > > > The installation directory you specified (via --install-dir, --prefix, or > > the distutils default setting) was: > > > > /usr/local/lib/python2.6/site-packages/ > > > > This directory does not currently exist. Please create it and try > again, or > > choose a different installation directory (using the -d or --install-dir > > option)*. > > > > So, how does Python keep track of what directories are / are not enabled > > for *.pth* processing ? > > > > easy_install doesn't seem to work for me. Any suggestions / inputs ? > > > > > > Thank you, > > -- > > Ashutosh Narayan > > > > http://ashutoshn.wordpress.com > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > -- > Pratap. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From lawgon at gmail.com Wed Dec 7 08:57:56 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Wed, 07 Dec 2011 13:27:56 +0530 Subject: [BangPypers] [commercial] django developer available Message-ID: <1323244680.2727.52.camel@xlquest.web> hi, one of my trainees is about to graduate. If you wish to employ him, please contact me offlist. note 1: he is not a rocket scientist and has no job experience, so if you have advanced positions, he will not suit. note 2: I charge a small fee for placement -- regards Kenneth Gonsalves From noufal at gmail.com Wed Dec 7 09:30:35 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 07 Dec 2011 14:00:35 +0530 Subject: [BangPypers] virtual-python & easy_install doubt In-Reply-To: (Ashutosh Narayan's message of "Wed, 7 Dec 2011 13:18:13 +0530") References: Message-ID: <87liqodbro.fsf@sanitarium.localdomain> Ashutosh Narayan writes: > Yes, virtualenv is an extension of virtual-python. I can try that as well. > But again my concern is why easy_install is not picking up the virtual > environment that I have set to. Any pointers ? [...] I don't think anyone uses virtual-python anymore. You should use virtualenv. Create an env, then activate it and then use easy_install (or preferably pip) to install packages inside it. There's also a virtualenvwrapper package to help management of virtualenvs. -- ~noufal http://nibrahim.net.in She used to diet on any kind of food she could lay her hands on. -- Arthur Baer, American comic and columnist From aashutoshnarayan at gmail.com Wed Dec 7 09:37:48 2011 From: aashutoshnarayan at gmail.com (Ashutosh Narayan) Date: Wed, 7 Dec 2011 14:07:48 +0530 Subject: [BangPypers] virtual-python & easy_install doubt In-Reply-To: <87liqodbro.fsf@sanitarium.localdomain> References: <87liqodbro.fsf@sanitarium.localdomain> Message-ID: OK. Giving it a shot then. Thanks ! On Wed, Dec 7, 2011 at 2:00 PM, Noufal Ibrahim wrote: > Ashutosh Narayan writes: > > > Yes, virtualenv is an extension of virtual-python. I can try that as > well. > > But again my concern is why easy_install is not picking up the virtual > > environment that I have set to. Any pointers ? > > [...] > > I don't think anyone uses virtual-python anymore. You should use > virtualenv. Create an env, then activate it and then use easy_install > (or preferably pip) to install packages inside it. > > There's also a virtualenvwrapper package to help management of virtualenvs. > > -- > ~noufal > http://nibrahim.net.in > > She used to diet on any kind of food she could lay her hands on. -- Arthur > Baer, American comic and columnist > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From bugcy013 at gmail.com Wed Dec 7 12:02:29 2011 From: bugcy013 at gmail.com (Ganesh Kumar) Date: Wed, 7 Dec 2011 16:32:29 +0530 Subject: [BangPypers] [JOB] Openings for Django programmers Message-ID: Job Description : Django programmers Key Responsibilities 1.Development & Integrations of Business Applications based on Django and other technologies. 2.Developer will be involved in the design,development life cycle of new Business solutions, maintenance and support of existing operational systems. What are we looking for? Candidates who thrives on tough technology challenges and can help turn innovative ideas into effective results. The person must have proven excellent verbal & written communication skills. Location Chennai. Job Skills Very strong knowledge in python, Django, Knowledge of Linux operating systems from any one like Ubuntu/Fedora/Debian/Centos. jquery is an Added advantage. Experience 0-1 years experience in django & python. Freshers are also welcome. Industry Type IT Consulting/ Software development Qualification BE & B.Tech (IT & CSE & ECE) , MCA , M.Sc (IT, SS & CS). Email If you feel you are perfectly suitable for any one of the above job, please send your CV to jobs at ethicstech.in Company: ethics Technologies #16/17, G2, B-Block, Suraj Nivas, Station Border Road, Chromepet,Chennai, Tamilnadu, India. 600044 -Ganesh. From 2002anand at gmail.com Wed Dec 7 15:11:50 2011 From: 2002anand at gmail.com (Anand Patil) Date: Wed, 7 Dec 2011 19:41:50 +0530 Subject: [BangPypers] BangPypers Digest, Vol 52, Issue 7 In-Reply-To: References: Message-ID: Hi. I have a unique question or may be i am not so perfect at python.Please help me out a, b, c = 0, 0, 0 def getabc(): print "hi " def gettuple(): print "hello all" def getlist(): print "bye" lis={"a":["getabc","gettuple","getlist"]} lis['a'][1]() why does this fail ? How to make it work? On Wed, Dec 7, 2011 at 4:30 PM, wrote: > Send BangPypers mailing list submissions to > bangpypers at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/bangpypers > or, via email, send a message with subject or body 'help' to > bangpypers-request at python.org > > You can reach the person managing the list at > bangpypers-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of BangPypers digest..." > > > Today's Topics: > > 1. Re: virtual-python & easy_install doubt (Ashutosh Narayan) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 7 Dec 2011 14:07:48 +0530 > From: Ashutosh Narayan > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] virtual-python & easy_install doubt > Message-ID: > > > Content-Type: text/plain; charset=ISO-8859-1 > > OK. Giving it a shot then. Thanks ! > > On Wed, Dec 7, 2011 at 2:00 PM, Noufal Ibrahim wrote: > > > Ashutosh Narayan writes: > > > > > Yes, virtualenv is an extension of virtual-python. I can try that as > > well. > > > But again my concern is why easy_install is not picking up the virtual > > > environment that I have set to. Any pointers ? > > > > [...] > > > > I don't think anyone uses virtual-python anymore. You should use > > virtualenv. Create an env, then activate it and then use easy_install > > (or preferably pip) to install packages inside it. > > > > There's also a virtualenvwrapper package to help management of > virtualenvs. > > > > -- > > ~noufal > > http://nibrahim.net.in > > > > She used to diet on any kind of food she could lay her hands on. -- > Arthur > > Baer, American comic and columnist > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > ------------------------------ > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > > > End of BangPypers Digest, Vol 52, Issue 7 > ***************************************** > From prataprc at gmail.com Wed Dec 7 15:24:31 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Wed, 7 Dec 2011 19:54:31 +0530 Subject: [BangPypers] BangPypers Digest, Vol 52, Issue 7 In-Reply-To: References: Message-ID: Try this, global()[ lis['a'][1] ]() or this, lis = { "a": [ getabc, gettuple, getlist ] } lis['a'][1]() On Wed, Dec 7, 2011 at 7:41 PM, Anand Patil <2002anand at gmail.com> wrote: > Hi. > > I have a unique question or may be i am not so perfect at python.Please > help me out > > a, b, c = 0, 0, 0 > def getabc(): > ? ?print "hi " > > def gettuple(): > ? ?print "hello all" > > def getlist(): > ? ?print "bye" > > lis={"a":["getabc","gettuple","getlist"]} > lis['a'][1]() > > why does this fail ? > How to make it work? > On Wed, Dec 7, 2011 at 4:30 PM, wrote: > >> Send BangPypers mailing list submissions to >> ? ? ? ?bangpypers at python.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> ? ? ? ?http://mail.python.org/mailman/listinfo/bangpypers >> or, via email, send a message with subject or body 'help' to >> ? ? ? ?bangpypers-request at python.org >> >> You can reach the person managing the list at >> ? ? ? ?bangpypers-owner at python.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of BangPypers digest..." >> >> >> Today's Topics: >> >> ? 1. Re: virtual-python & easy_install doubt (Ashutosh Narayan) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Wed, 7 Dec 2011 14:07:48 +0530 >> From: Ashutosh Narayan >> To: Bangalore Python Users Group - India >> Subject: Re: [BangPypers] virtual-python & easy_install doubt >> Message-ID: >> ? ? ? ?> > >> Content-Type: text/plain; charset=ISO-8859-1 >> >> OK. Giving it a shot then. Thanks ! >> >> On Wed, Dec 7, 2011 at 2:00 PM, Noufal Ibrahim wrote: >> >> > Ashutosh Narayan writes: >> > >> > > Yes, virtualenv is an extension of virtual-python. I can try that as >> > well. >> > > But again my concern is why easy_install is not picking up the virtual >> > > environment that I have set to. Any pointers ? >> > >> > [...] >> > >> > I don't think anyone uses virtual-python anymore. You should use >> > virtualenv. Create an env, then activate it and then use easy_install >> > (or preferably pip) to install packages inside it. >> > >> > There's also a virtualenvwrapper package to help management of >> virtualenvs. >> > >> > -- >> > ~noufal >> > http://nibrahim.net.in >> > >> > She used to diet on any kind of food she could lay her hands on. -- >> Arthur >> > Baer, American comic and columnist >> > _______________________________________________ >> > BangPypers mailing list >> > BangPypers at python.org >> > http://mail.python.org/mailman/listinfo/bangpypers >> > >> >> >> ------------------------------ >> >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> >> >> End of BangPypers Digest, Vol 52, Issue 7 >> ***************************************** >> > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. From sateeshpyper at gmail.com Wed Dec 7 20:35:59 2011 From: sateeshpyper at gmail.com (Sateesh Kumar) Date: Thu, 8 Dec 2011 01:05:59 +0530 Subject: [BangPypers] BangPypers Digest, Vol 52, Issue 7 In-Reply-To: References: Message-ID: On Wed, Dec 7, 2011 at 7:41 PM, Anand Patil <2002anand at gmail.com> wrote: > Hi. > > I have a unique question or may be i am not so perfect at python.Please > help me out > > a, b, c = 0, 0, 0 > def getabc(): > print "hi " > > def gettuple(): > print "hello all" > > def getlist(): > print "bye" > > lis={"a":["getabc","gettuple","getlist"]} > lis['a'][1]() > > why does this fail ? > The failure message that you get would give you a hint about reason for failure. You are storing a list of strings (the method names) as value for dictionary key 'a'. The invocation : lis['a'][1]() results in call similar to "gettuple"() resulting in error: "TypeError: 'str' object is not callable". What you intend to do is to store function objects in the list and and you can do this as below: lis={"a":[getabc,gettuple,getlist]} reg, sateesh From alind_sap at yahoo.com Thu Dec 8 09:49:06 2011 From: alind_sap at yahoo.com (alind sharma) Date: Thu, 8 Dec 2011 14:19:06 +0530 (IST) Subject: [BangPypers] BangPypers Digest, Vol 52, Issue 7 In-Reply-To: References: Message-ID: <1323334146.2063.YahooMailNeo@web94901.mail.in2.yahoo.com> I hope that you dont want something like multimethods as described in this thread by Guido. (Your function naming suggests something in that direction) http://www.artima.com/weblogs/viewpost.jsp?thread=101605 ? Alind Sharma ________________________________ From: Anand Patil <2002anand at gmail.com> To: bangpypers at python.org Sent: Wednesday, 7 December 2011 7:41 PM Subject: Re: [BangPypers] BangPypers Digest, Vol 52, Issue 7 Hi. I have a unique question or may be i am not so perfect at python.Please help me out a, b, c = 0, 0, 0 def getabc(): ? ? print "hi " def gettuple(): ? ? print "hello all" def getlist(): ? ? print "bye" lis={"a":["getabc","gettuple","getlist"]} lis['a'][1]() why does this fail ? How to make it work? On Wed, Dec 7, 2011 at 4:30 PM, wrote: > Send BangPypers mailing list submissions to >? ? ? ? bangpypers at python.org > > To subscribe or unsubscribe via the World Wide Web, visit >? ? ? ? http://mail.python.org/mailman/listinfo/bangpypers > or, via email, send a message with subject or body 'help' to >? ? ? ? bangpypers-request at python.org > > You can reach the person managing the list at >? ? ? ? bangpypers-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of BangPypers digest..." > > > Today's Topics: > >? 1. Re: virtual-python & easy_install doubt (Ashutosh Narayan) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 7 Dec 2011 14:07:48 +0530 > From: Ashutosh Narayan > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] virtual-python & easy_install doubt > Message-ID: >? ? ? ? > > Content-Type: text/plain; charset=ISO-8859-1 > > OK. Giving it a shot then. Thanks ! > > On Wed, Dec 7, 2011 at 2:00 PM, Noufal Ibrahim wrote: > > > Ashutosh Narayan writes: > > > > > Yes, virtualenv is an extension of virtual-python. I can try that as > > well. > > > But again my concern is why easy_install is not picking up the virtual > > > environment that I have set to. Any pointers ? > > > > [...] > > > > I don't think anyone uses virtual-python anymore. You should use > > virtualenv. Create an env, then activate it and then use easy_install > > (or preferably pip) to install packages inside it. > > > > There's also a virtualenvwrapper package to help management of > virtualenvs. > > > > -- > > ~noufal > > http://nibrahim.net.in > > > > She used to diet on any kind of food she could lay her hands on. -- > Arthur > > Baer, American comic and columnist > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > ------------------------------ > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > > > End of BangPypers Digest, Vol 52, Issue 7 > ***************************************** > _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers From benignbala at gmail.com Thu Dec 8 09:56:07 2011 From: benignbala at gmail.com (Balachandran Sivakumar) Date: Thu, 8 Dec 2011 14:26:07 +0530 Subject: [BangPypers] Issues with invoking methods (was Re: BangPypers Digest, Vol 52, Issue 7) Message-ID: Hi, On Wed, Dec 7, 2011 at 7:41 PM, Anand Patil <2002anand at gmail.com> wrote: > > lis={"a":["getabc","gettuple","getlist"]} > lis['a'][1]() > The values assigned to 'a' are all strings. Not the methods that you have declared. lis={"a":[getabc,gettuple,getlist]} will work(Note that there are not quotes around the names of the methods. ) Also, please do not reply to digest emails directly. It makes it really difficult when we read. I have changed the subject line now. Thanks -- Thank you Balachandran Sivakumar Arise Awake and stop not till the goal is reached. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?- Swami Vivekananda Mail: benignbala at gmail.com Blog: http://benignbala.wordpress.com/ From alind_sap at yahoo.com Thu Dec 8 10:01:38 2011 From: alind_sap at yahoo.com (alind sharma) Date: Thu, 8 Dec 2011 14:31:38 +0530 (IST) Subject: [BangPypers] Issues with invoking methods (was Re: BangPypers Digest, Vol 52, Issue 7) In-Reply-To: References: Message-ID: <1323334898.84829.YahooMailNeo@web94912.mail.in2.yahoo.com> Got it. (regarding digest emails) ? Alind Sharma ________________________________ From: Balachandran Sivakumar To: Bangalore Python Users Group - India Sent: Thursday, 8 December 2011 2:26 PM Subject: [BangPypers] Issues with invoking methods (was Re: BangPypers Digest, Vol 52, Issue 7) Hi, On Wed, Dec 7, 2011 at 7:41 PM, Anand Patil <2002anand at gmail.com> wrote: > > lis={"a":["getabc","gettuple","getlist"]} > lis['a'][1]() > ? ? ? The values assigned to 'a' are all strings. Not the methods that you have declared. lis={"a":[getabc,gettuple,getlist]} will work(Note that there are not quotes around the names of the methods. ) Also, please do not reply to digest emails directly. It makes it really difficult when we read. I have changed the subject line now. Thanks -- Thank you Balachandran Sivakumar Arise Awake and stop not till the goal is reached. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?- Swami Vivekananda Mail: benignbala at gmail.com Blog: http://benignbala.wordpress.com/ _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers From prataprc at gmail.com Thu Dec 8 13:23:39 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Thu, 8 Dec 2011 17:53:39 +0530 Subject: [BangPypers] BangPypers Digest, Vol 52, Issue 7 In-Reply-To: <1323334146.2063.YahooMailNeo@web94901.mail.in2.yahoo.com> References: <1323334146.2063.YahooMailNeo@web94901.mail.in2.yahoo.com> Message-ID: Thanks for this pointer. Very much like spirit of python, "If you can do it as library, don't except it from the language (python)" .... On Thu, Dec 8, 2011 at 2:19 PM, alind sharma wrote: > I hope that you dont want something like multimethods as described in this thread by Guido. > (Your function naming suggests something in that direction) > > http://www.artima.com/weblogs/viewpost.jsp?thread=101605 > > > Alind Sharma > > > ________________________________ > ?From: Anand Patil <2002anand at gmail.com> > To: bangpypers at python.org > Sent: Wednesday, 7 December 2011 7:41 PM > Subject: Re: [BangPypers] BangPypers Digest, Vol 52, Issue 7 > > Hi. > > I have a unique question or may be i am not so perfect at python.Please > help me out > > a, b, c = 0, 0, 0 > def getabc(): > ? ? print "hi " > > def gettuple(): > ? ? print "hello all" > > def getlist(): > ? ? print "bye" > > lis={"a":["getabc","gettuple","getlist"]} > lis['a'][1]() > > why does this fail ? > How to make it work? > On Wed, Dec 7, 2011 at 4:30 PM, wrote: > >> Send BangPypers mailing list submissions to >>? ? ? ? bangpypers at python.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >>? ? ? ? http://mail.python.org/mailman/listinfo/bangpypers >> or, via email, send a message with subject or body 'help' to >>? ? ? ? bangpypers-request at python.org >> >> You can reach the person managing the list at >>? ? ? ? bangpypers-owner at python.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of BangPypers digest..." >> >> >> Today's Topics: >> >>? ?1. Re: virtual-python & easy_install doubt (Ashutosh Narayan) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Wed, 7 Dec 2011 14:07:48 +0530 >> From: Ashutosh Narayan >> To: Bangalore Python Users Group - India >> Subject: Re: [BangPypers] virtual-python & easy_install doubt >> Message-ID: >>? ? ? ? > > >> Content-Type: text/plain; charset=ISO-8859-1 >> >> OK. Giving it a shot then. Thanks ! >> >> On Wed, Dec 7, 2011 at 2:00 PM, Noufal Ibrahim wrote: >> >> > Ashutosh Narayan writes: >> > >> > > Yes, virtualenv is an extension of virtual-python. I can try that as >> > well. >> > > But again my concern is why easy_install is not picking up the virtual >> > > environment that I have set to. Any pointers ? >> > >> > [...] >> > >> > I don't think anyone uses virtual-python anymore. You should use >> > virtualenv. Create an env, then activate it and then use easy_install >> > (or preferably pip) to install packages inside it. >> > >> > There's also a virtualenvwrapper package to help management of >> virtualenvs. >> > >> > -- >> > ~noufal >> > http://nibrahim.net.in >> > >> > She used to diet on any kind of food she could lay her hands on. -- >> Arthur >> > Baer, American comic and columnist >> > _______________________________________________ >> > BangPypers mailing list >> > BangPypers at python.org >> > http://mail.python.org/mailman/listinfo/bangpypers >> > >> >> >> ------------------------------ >> >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> >> >> End of BangPypers Digest, Vol 52, Issue 7 >> ***************************************** >> > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. From prataprc at gmail.com Thu Dec 8 13:26:12 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Thu, 8 Dec 2011 17:56:12 +0530 Subject: [BangPypers] Issues with invoking methods (was Re: BangPypers Digest, Vol 52, Issue 7) In-Reply-To: <1323334898.84829.YahooMailNeo@web94912.mail.in2.yahoo.com> References: <1323334898.84829.YahooMailNeo@web94912.mail.in2.yahoo.com> Message-ID: > Got it. (regarding digest emails) Got it slightly later :) From sajuptpm at gmail.com Thu Dec 8 15:04:44 2011 From: sajuptpm at gmail.com (Saju M) Date: Thu, 8 Dec 2011 09:04:44 -0500 Subject: [BangPypers] Documentation using Sphinx Message-ID: Hi, I am trying source code documentation using Sphinx. Here i have to copy paste all modules in to *.rst file, that is painful. Have any way to create documentation (doc for all modules, classes and methods in the project directory) from project folder quickly. I also plannig to add a code browsing facility in the document, for example: code should display if we click on a method/class name in the doc, does sphinx has this feature??? or what tool i have to choose for that ???. From prataprc at gmail.com Thu Dec 8 17:15:15 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Thu, 8 Dec 2011 21:45:15 +0530 Subject: [BangPypers] Documentation using Sphinx In-Reply-To: References: Message-ID: Sphinx should do good. I have used it for documenting our CouchPy library. A documented module source will look like this, http://code.google.com/p/couchpy/source/browse/couchpy/database.py Which gets converted to HTML document like, http://packages.python.org/couchpy/modules/database.html You can learn how to organise documentation for your package by following this tutorial, http://sphinx.pocoo.org/tutorial.html And for live example, follow *.rst files under http://code.google.com/p/couchpy/source/browse/#hg%2Fdocs starting from index.rst file under the docs/ directory. Cheers, On Thu, Dec 8, 2011 at 7:34 PM, Saju M wrote: > Hi, > I am trying source code documentation using Sphinx. Here i have to > copy paste all modules in to *.rst file, that is painful. Have any way > to create documentation (doc for all modules, classes and methods in > the project directory) from project folder quickly. I also plannig to > add a code browsing facility in the document, for example: code should > display if we click on a method/class name in the doc, does sphinx has > this feature??? ?or what tool i have to choose for that ???. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. From vikas.bn at gmail.com Fri Dec 9 07:26:49 2011 From: vikas.bn at gmail.com (Vikas BN) Date: Fri, 9 Dec 2011 11:56:49 +0530 Subject: [BangPypers] Commenting code regions and indentation (Emacs, Python) Message-ID: Hi All, ? I use Emacs for my editing and python-mode.el specifically for python editing. ? However, I want to change the default behaviour of commenting regions in Emacs. ? Currently, when I select a region and hit M-; Emacs comments out the region like so: def main(): ? ?if cond: # ? ? ? a = b # ? ? ? c = d ? ?else: ? ? ? foo = bar ? Note how the comment starts at the beginning of the line irrespective of how "deep" the region is. ? I want something more like so (comment char is aligned to the indented block of code): def main(): ? ?if cond: ? ?# ?a = b ? ?# ?c = d ? ?else: ? ? ? foo = bar ? Anybody has ideas on how to achieve this? Thanks! Vikas From noufal at gmail.com Fri Dec 9 07:52:54 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Fri, 09 Dec 2011 12:22:54 +0530 Subject: [BangPypers] Commenting code regions and indentation (Emacs, Python) In-Reply-To: (Vikas BN's message of "Fri, 9 Dec 2011 11:56:49 +0530") References: Message-ID: <87vcpq9qyh.fsf@sanitarium.localdomain> Vikas BN writes: > Hi All, > > ? I use Emacs for my editing and python-mode.el specifically for > python editing. The mode that's *not* part of Emacs. Correct? > ? However, I want to change the default behaviour of commenting > regions in Emacs. > ? Currently, when I select a region and hit M-; Emacs comments out the > region like so: > > def main(): > ? ?if cond: > # ? ? ? a = b > # ? ? ? c = d > ? ?else: > ? ? ? foo = bar I use python.el shipped as part of Emacs and I get the behaviour which you prefer. I looked through python-mode.el and found a few comment related settings that you can tweak which change indentation etc. for comments. They're all there in the customize-mode buffer for the mode. I tweaked them a little but couldn't see any obvious changes but I think it has to do with the positions of point and mark in my buffer. You could try those. python-honour-comment-indentation mainly. [...] -- ~noufal http://nibrahim.net.in Hegel was right when he said that we learn from history that man can never learn anything from history. -George Bernard Shaw From vikas.bn at gmail.com Fri Dec 9 08:38:57 2011 From: vikas.bn at gmail.com (Vikas BN) Date: Fri, 9 Dec 2011 13:08:57 +0530 Subject: [BangPypers] Commenting code regions and indentation (Emacs, Python) In-Reply-To: <87vcpq9qyh.fsf@sanitarium.localdomain> References: <87vcpq9qyh.fsf@sanitarium.localdomain> Message-ID: Noufal, On Fri, Dec 9, 2011 at 12:22 PM, Noufal Ibrahim wrote: > The mode that's *not* part of Emacs. Correct? Yes, because I'm stuck with 21.1 :( > could try those. python-honour-comment-indentation mainly. Thanks! I'll try that out. -Vikas From koppula at gmail.com Fri Dec 9 12:10:39 2011 From: koppula at gmail.com (Prashanth Koppula) Date: Fri, 9 Dec 2011 16:40:39 +0530 Subject: [BangPypers] Yahoo BOSS Mashup Framework and Python 2.7 Message-ID: Has anyone been successful in getting the Yahoo BOSS Mashup Frameworkto work with Python 2.7? I ran into several issues including authorization related, and it looked like the BOSS framework, which seemed to be designed for Python 2.5, hadn't been updated in a while. Are there other starting points that work better with Python 2.7 than using this framework? Prashanth From supreet.sethi at gmail.com Fri Dec 9 13:21:57 2011 From: supreet.sethi at gmail.com (s|s) Date: Fri, 9 Dec 2011 17:51:57 +0530 Subject: [BangPypers] Yahoo BOSS Mashup Framework and Python 2.7 In-Reply-To: References: Message-ID: I wrote a simple library interface to Yahoo BOSS. You could give it a try. I have found it to be simpler compared to their framework. It is available at https://github.com/djinn/boss . Do tell me if you find any problems using it. -- Supreet Sethi Ph IN: +919811143517 Ph Skype: d_j_i_n_n Profile: http://www.google.com/profiles/supreet.sethi Twt: http://twitter.com/djinn From koppula at gmail.com Fri Dec 9 13:30:03 2011 From: koppula at gmail.com (Prashanth Koppula) Date: Fri, 9 Dec 2011 18:00:03 +0530 Subject: [BangPypers] Yahoo BOSS Mashup Framework and Python 2.7 In-Reply-To: References: Message-ID: On Fri, Dec 9, 2011 at 5:51 PM, s|s wrote: > I wrote a simple library interface to Yahoo BOSS. You could give it a > try. I have found it to be simpler compared to their framework. It is > available at https://github.com/djinn/boss . > > Do tell me if you find any problems using it. > > > Thanks Supreet. I'll try it out. Meanwhile I found a SO thread that helped a great deal (and not surprisingly, none of the suggestions involved their framework): http://stackoverflow.com/questions/6796722/yahoo-boss-v2-authorization-troubles > -- > Supreet Sethi > Ph IN: +919811143517 > Ph Skype: d_j_i_n_n > Profile: http://www.google.com/profiles/supreet.sethi > Twt: http://twitter.com/djinn > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From cjgiridhar at gmail.com Sat Dec 10 15:37:43 2011 From: cjgiridhar at gmail.com (chetan giridhar) Date: Sat, 10 Dec 2011 20:07:43 +0530 Subject: [BangPypers] Fwd: GlobalLogic Python Position In-Reply-To: References: Message-ID: FYI... ---------- Forwarded message ---------- From: Richa Sinha Date: Sat, Dec 10, 2011 at 3:17 PM Subject: GlobalLogic Python Position To: cjgiridhar at gmail.com Hi Chetan, It was really nice talking to you.As discussed,please do the needful. We have a very exciting job opportunity to share with you,We are looking for highly skilled *Python Developers/Sr.Developers/Leads* for one of our strategic engagements with *Google. * Following are the details: *Experience* 2 -5 years *Location*- Gurgaon *Number of positions:* 20 *JD:* *Python Developer(s)* * * Experience: 2-3 Yrs Min Qualification: BS/BE/B.Tech/MCA Regular Job Location: Gurgaon (Delhi NCR) *Requisites:* - OOPS concepts in Python - Exposure to python as a language , not only as a script - Good knowledge of File handling and XML parsing - Good to have experience in Multithreading in python. - Usage of inbuilt data types. - Implementation Of various design patterns - Should have Worked On python specific packages - Should have Worked On python specific frameworks like django, zope, - Exposure to middlewares, decorators, etc. - He should have worked on web apps instead of desktop apps. *Python Sr. Developer(s)* Experience: 3-5 Yrs Min Qualification: BS/BE/B.Tech/MCA Regular Job Location: Gurgaon *Requisites:* - OOPS concepts in Python - Exposure to python as a language , not only as a script - Good knowledge of File handling and XML parsing - Good to have experience in Multithreading in python. - Usage of inbuilt data types. - Implementation Of various design patterns - Should have Worked On python specific packages - Should have Worked On python specific frameworks like django, zope, middlewares, decorators, etc.. - He should have worked on web apps instead of desktop apps. *Share this mail , spread the great opportunity :) *Do visit **www.globallogic.com* -- Regards, Richa Sinha | Talent Acquisition *Leaders in Software R&D Services* *www.globallogic.com* ARGENTINA |CHINA | INDIA | ISRAEL | UKRAINE | UK | USA Office: +91-120-406-2378 http://www.youtube.com/watch?v=V4pwY800TII -- Regards, Chetan http://technobeans.com From lawgon at gmail.com Sun Dec 11 03:22:24 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Sun, 11 Dec 2011 07:52:24 +0530 Subject: [BangPypers] Fwd: GlobalLogic Python Position In-Reply-To: References: Message-ID: <1323570147.2727.106.camel@xlquest.web> On Sat, 2011-12-10 at 20:07 +0530, chetan giridhar wrote: > - OOPS concepts in Python they want people who apologise when they drop things? -- regards Kenneth Gonsalves From smrutilekha at gmail.com Mon Dec 12 09:36:16 2011 From: smrutilekha at gmail.com (Smrutilekha Swain) Date: Mon, 12 Dec 2011 14:06:16 +0530 Subject: [BangPypers] Problem in filling the QTableWidget In-Reply-To: References: Message-ID: Hello everybody................... Thanzzzzzzzz 4 d help.......but now i need help....... i have a QListWidget which contains the list of ip address of the other pc. A QTablewidget which contains 5 columns - ip address(which will take from QListWidget), compare, similar, pass/fail(it is an Icon) and remarks. A pushButton which says RUN. On clicking the button all the data should update in the table i can update ip address row by row but rest of the column can't b updated. my code: def run(self): countRows = self.listWidget.count() for i in range(countRows): strItem = self.listWidget.item().text() self.tableWidgetItem = QTableWidgetItem() self.tableWidgetItem.setText(QString(strItem)) self.table.setItem(i,0,self.tableWidgetItem) str1 = QString("1") self.tableWidgetItem.setText(str1) self.table.setItem(i,1,self.tableWidgetItem) str1 = QString("2") self.tableWidgetItem.setText(str2) self.table.setItem(i,2,self.tableWidgetItem) self.tableWidgetItem.setIcon(QIcon(QPixmap("../Icons/tick.png))) self.table.setItem(i,3,self.tableWidgetItem) str1 = QString("4") self.tableWidgetItem.setText(str4) self.table.setItem(i,4,self.tableWidgetItem) but when i clicked the RUN button. the column of ip address displays correct data but in 2nd column it shows "4" n error "QTableWidget: can't read QTableWidgetItem that is owned by another QTableWidgetItem" Plzzzzzzzz help me........ASAP........Thanzzzzzzzzzz in advance.................... plzzzzzzz help me!!!!!!!!!!!!!!!!! itzzzzzzzzzz urgent!!!!!!!!!!!!!!!!!!!! From asif.jamadar at rezayat.net Mon Dec 12 10:28:52 2011 From: asif.jamadar at rezayat.net (Asif Jamadar) Date: Mon, 12 Dec 2011 09:28:52 +0000 Subject: [BangPypers] request.POST.getlist in django formset Message-ID: How can I use request.POST.getlist in django formset? However I can able to use request.POST.getlist for Modelform by just specifying the field name but how can I do the same with formset? From sajuptpm at gmail.com Mon Dec 12 12:05:34 2011 From: sajuptpm at gmail.com (Saju M) Date: Mon, 12 Dec 2011 06:05:34 -0500 Subject: [BangPypers] Sphinx inheritance-diagram Issue Message-ID: I created complete API documentation using sphinx. Command i used are: $ sphinx-apidoc -f -F -o . /home/sam/CMS $ make html Then i planned to add inheritance-diagram of classes, for that i edited "provider.rst" file and added two new lines as shown below. provider diagram ---------------- .. inheritance-diagram:: CMS.cloud.DbModel.CloudProvider Then i did "$ make html" again, after that i could see the new heading "provider diagram", but could not see any diagram. I did not get any errors. Note: ===== * Here CloudProvider is a module. ############ provider.rst fiel############ DbModel Package =============== :mod:`CPTypes` Module --------------------- .. automodule:: CMS.cloud.DbModel.CPTypes :members: :undoc-members: :show-inheritance: :mod:`CloudProvider` Module --------------------------- .. automodule:: CMS.cloud.DbModel.CloudProvider :members: :undoc-members: :show-inheritance: provider diagram ---------------- .. inheritance-diagram:: CMS.cloud.DbModel.CloudProvider :mod:`Network` Module --------------------- .. automodule:: CMS.cloud.DbModel.Network :members: :undoc-members: :show-inheritance: From sajuptpm at gmail.com Mon Dec 12 13:15:38 2011 From: sajuptpm at gmail.com (Saju M) Date: Mon, 12 Dec 2011 07:15:38 -0500 Subject: [BangPypers] Sphinx inheritance-diagram Issue In-Reply-To: References: Message-ID: Hi, Issue solved by adding "sphinx.ext.inheritance_diagram" to your conf.py - extensions On Mon, Dec 12, 2011 at 6:05 AM, Saju M wrote: > I created complete API documentation using sphinx. > Command i used are: > $ sphinx-apidoc -f -F -o . /home/sam/CMS > $ make html > > Then i planned to add inheritance-diagram of classes, for that i > edited "provider.rst" file and added two new lines as shown below. > > provider diagram > ---------------- > .. inheritance-diagram:: CMS.cloud.DbModel.CloudProvider > > > Then i did "$ make html" again, after that i could see the new heading > "provider diagram", but could not see any diagram. > I did not get any errors. > > > Note: > ===== > * Here CloudProvider is a module. > > > > ############ provider.rst fiel############ > > DbModel Package > =============== > > :mod:`CPTypes` Module > --------------------- > > .. automodule:: CMS.cloud.DbModel.CPTypes > ? ?:members: > ? ?:undoc-members: > ? ?:show-inheritance: > > :mod:`CloudProvider` Module > --------------------------- > > .. automodule:: CMS.cloud.DbModel.CloudProvider > ? ?:members: > ? ?:undoc-members: > ? ?:show-inheritance: > > provider diagram > ---------------- > > .. inheritance-diagram:: CMS.cloud.DbModel.CloudProvider > > > :mod:`Network` Module > --------------------- > > .. automodule:: CMS.cloud.DbModel.Network > ? ?:members: > ? ?:undoc-members: > ? ?:show-inheritance: From sajuptpm at gmail.com Mon Dec 12 13:16:28 2011 From: sajuptpm at gmail.com (Saju M) Date: Mon, 12 Dec 2011 07:16:28 -0500 Subject: [BangPypers] Sphinx inheritance-diagram Issue In-Reply-To: References: Message-ID: Another Issue: I am using "sphinx-apidoc" for documentation $ sphinx-apidoc -f -F -o . /home/sam/CMS $ make html I want to include class 'inheritance-diagram' in all my module document page. Right now, i have to edit all *rst file and add two lines as shown below, for each modules. class inheritance diagram ------------------------- .. inheritance-diagram:: CMS.cloud.DbModel.modulename Have any otherway to do it in single shot, like what "sphinx-apidoc" did for documentation ??? I could not find any option in document of "sphinx-apidoc" tool http://sphinx.pocoo.org/invocation.html#invocation-of-sphinx-apidoc On Mon, Dec 12, 2011 at 7:15 AM, Saju M wrote: > Hi, > Issue solved by adding "sphinx.ext.inheritance_diagram" to your > conf.py - extensions > > On Mon, Dec 12, 2011 at 6:05 AM, Saju M wrote: >> I created complete API documentation using sphinx. >> Command i used are: >> $ sphinx-apidoc -f -F -o . /home/sam/CMS >> $ make html >> >> Then i planned to add inheritance-diagram of classes, for that i >> edited "provider.rst" file and added two new lines as shown below. >> >> provider diagram >> ---------------- >> .. inheritance-diagram:: CMS.cloud.DbModel.CloudProvider >> >> >> Then i did "$ make html" again, after that i could see the new heading >> "provider diagram", but could not see any diagram. >> I did not get any errors. >> >> >> Note: >> ===== >> * Here CloudProvider is a module. >> >> >> >> ############ provider.rst fiel############ >> >> DbModel Package >> =============== >> >> :mod:`CPTypes` Module >> --------------------- >> >> .. automodule:: CMS.cloud.DbModel.CPTypes >> ? ?:members: >> ? ?:undoc-members: >> ? ?:show-inheritance: >> >> :mod:`CloudProvider` Module >> --------------------------- >> >> .. automodule:: CMS.cloud.DbModel.CloudProvider >> ? ?:members: >> ? ?:undoc-members: >> ? ?:show-inheritance: >> >> provider diagram >> ---------------- >> >> .. inheritance-diagram:: CMS.cloud.DbModel.CloudProvider >> >> >> :mod:`Network` Module >> --------------------- >> >> .. automodule:: CMS.cloud.DbModel.Network >> ? ?:members: >> ? ?:undoc-members: >> ? ?:show-inheritance: From sajuptpm at gmail.com Thu Dec 15 10:04:28 2011 From: sajuptpm at gmail.com (Saju M) Date: Thu, 15 Dec 2011 04:04:28 -0500 Subject: [BangPypers] UML diagrams from python source code Message-ID: Hi, I'm looking for a good tool that can automatically generatre UML diagrams from python source code. From trmlist at gmail.com Thu Dec 15 10:29:49 2011 From: trmlist at gmail.com (Thin Rhino) Date: Thu, 15 Dec 2011 14:59:49 +0530 Subject: [BangPypers] [commercial] Python Requirements In-Reply-To: References: Message-ID: The company Clogeny Technologies Pvt. Ltd. (Pune), I work for, is currently looking to hire people with experience and / or interest to work on Python. If you think you would like to work with the company, please send us your updated resume to careers at clogeny.com Regards ThinRhino Post: Cloud Engineers Openings: 2 Experience: 1.5 - 5 years of experience Experience: - Relevant experience in Python/Django or Perl - Clear Understanding of SOA and Webservices - REST and SOAP - Clear Understanding of MVC, Webservices frameworks - Experience with Linux Environment is a huge benefit - Good Database design principles - Understanding of Cloud Computing concepts is a plus - Agile development principles. -- Ships are safe in the harbor, but that is not what ships are built for From amit.pureenergy at gmail.com Thu Dec 15 11:58:14 2011 From: amit.pureenergy at gmail.com (Amit Sethi) Date: Thu, 15 Dec 2011 16:28:14 +0530 Subject: [BangPypers] UML diagrams from python source code In-Reply-To: References: Message-ID: Try Lumpy a reverse engineering tool for python. http://allendowney.com/swampy/lumpy.html -- A-M-I-T S|S From richa.sinha at globallogic.com Fri Dec 16 10:58:21 2011 From: richa.sinha at globallogic.com (Richa Sinha) Date: Fri, 16 Dec 2011 15:28:21 +0530 Subject: [BangPypers] GlobalLogic PYTHON/JAVA In-Reply-To: References: Message-ID: Hi All , Trust you doing well.. GlobalLogic is looking for highly skilled *Python Developers/Sr.Developers* , *JAVA DEVELOPERS/Sr. Developers* for one of our strategic engagements with *Internet Giant. * Following are the details: > >> *Python Developer(s)/Sr. Developers* >> >> >> >> Experience: 1-5 Yrs >> >> Min Qualification: BS/BE/B.Tech/MCA Regular >> >> Job Location: Gurgaon (@ Google office) >> >> Positions: 20 >> >> * * >> >> *Requisites:* >> >> >> - * * OOPS concepts in Python >> - Exposure to python as a language , not only as a script >> - Good knowledge of File handling and XML parsing >> - Good to have experience in Multithreading in python. >> - Usage of inbuilt data types. >> - Implementation Of various design patterns >> - Should have Worked On python specific packages >> - Should have Worked On python specific frameworks like >> django, zope, >> - Exposure to middlewares, decorators, etc. >> - He should have worked on web apps instead of desktop apps. >> >> For Python: Send updated CV to richa.sinha at globallogic.com > * >> * >> >> *JAVA Positions: * >> >> * >> * >> >> *Min Qualification*: BS/BE/B.Tech/MCA or equivalent. >> >> *Location* ? Gurgaon (Google Office) >> >> *Positions: 10* >> *Experience*: Total work exp should be 2 - 5 yrs >> >> - Work experience and relevant experience in internet architecture >> and software development. >> - Fluency in at least two of the following languages: Java, >> JavaScript. >> - Expertise in object-oriented programming and design patterns >> (primarily MVC). >> - Hands on experience in database design, SQL and any ORM tool like >> Hibernate/JDO etc. >> - Experience in TDD based developmen. >> >> >> *Desired Skills*: >> >> - Innovativeness; ability to think outside the box . >> - Creativity and problem-solving ability . >> - Very good communication skills; must be able to gather requirements >> from potential users and discuss the requirements effectively with a >> technical team of developers . >> - Previous experience in developing web applications will be an added >> advantage. >> Working knowledge of linux environment is a plus. >> - Previous experience of working with Google tools/gadgets is a big >> plus. >> >> For Java : Send updated CV to ankit.bansal1 at globallogic.com * Do visit* www.globallogic.com* **Share this mail with your friends, alumni groups,communities etc., spread the great opportunity :) * -- Regards, Richa Sinha | Talent Acquisition *Leaders in Software R&D Services* *www.globallogic.com* ARGENTINA |CHINA | INDIA | ISRAEL | UKRAINE | UK | USA Office: +91-120-406-2378 http://www.youtube.com/watch?v=V4pwY800TII From vsapre80 at gmail.com Fri Dec 16 14:14:33 2011 From: vsapre80 at gmail.com (Vishal) Date: Fri, 16 Dec 2011 18:44:33 +0530 Subject: [BangPypers] UML diagrams from python source code In-Reply-To: References: Message-ID: On Thu, Dec 15, 2011 at 2:34 PM, Saju M wrote: > Hi, > > I'm looking for a good tool that can automatically generatre UML > diagrams from python source code. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > Hello, While it may not be of use to you now...BOUML can do the exact opposite of what you are asking. Try it out to see if it can consume Python and generate UML? -- Thanks and best regards, Vishal Sapre From venkat83 at gmail.com Sat Dec 17 01:26:30 2011 From: venkat83 at gmail.com (Venkatraman S) Date: Sat, 17 Dec 2011 05:56:30 +0530 Subject: [BangPypers] Baypiggies Message-ID: So i am vising bay area and turned up for the baypiggies group meeting yesterday. There was a talk on whats 'pythonic'. What was interesting was, of the 20people who turned up, around 5 were *really* old , i mean with white hair, and these were the people who actively took part in the discussion and asked Qs. I was really humbled by the experience. Just wanted to share this nice rendezvous. -V From noufal at gmail.com Sat Dec 17 05:10:20 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Sat, 17 Dec 2011 09:40:20 +0530 Subject: [BangPypers] Baypiggies In-Reply-To: (Venkatraman S.'s message of "Sat, 17 Dec 2011 05:56:30 +0530") References: Message-ID: <87k45vu9cj.fsf@sanitarium.localdomain> It's been too long since we even *had* a user group meeting. Why the apathy? Venkatraman S writes: > So i am vising bay area and turned up for the baypiggies group meeting > yesterday. There was a talk on whats 'pythonic'. > > What was interesting was, of the 20people who turned up, around 5 were > *really* old , i mean with white hair, and these were the people who > actively took part in the discussion and asked Qs. I was really humbled by > the experience. > > Just wanted to share this nice rendezvous. > > -V > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- ~noufal http://nibrahim.net.in I am a deeply superficial person. -Andy Warhol From prataprc at gmail.com Sat Dec 17 05:45:59 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Sat, 17 Dec 2011 10:15:59 +0530 Subject: [BangPypers] Baypiggies In-Reply-To: <87k45vu9cj.fsf@sanitarium.localdomain> References: <87k45vu9cj.fsf@sanitarium.localdomain> Message-ID: How about first week of January ? 7th or 8th. On Sat, Dec 17, 2011 at 9:40 AM, Noufal Ibrahim wrote: > > It's been too long since we even *had* a user group meeting. Why the > apathy? > > > Venkatraman S writes: > >> So i am vising bay area and turned up for the baypiggies group meeting >> yesterday. There was a talk on whats 'pythonic'. >> >> What was interesting was, of the 20people who turned up, around 5 were >> *really* old , i mean with white hair, and these were the people who >> actively took part in the discussion and asked Qs. I was really humbled by >> the experience. >> >> Just wanted to share this nice rendezvous. >> >> -V >> _______________________________________________ >> BangPypers mailing list >> BangPypers at python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > -- > ~noufal > http://nibrahim.net.in > > I am a deeply superficial person. -Andy Warhol > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. From kracethekingmaker at gmail.com Sat Dec 17 07:07:57 2011 From: kracethekingmaker at gmail.com (kracekumar ramaraju) Date: Sat, 17 Dec 2011 11:37:57 +0530 Subject: [BangPypers] Baypiggies In-Reply-To: References: <87k45vu9cj.fsf@sanitarium.localdomain> Message-ID: +1 => Lets have a User Group meeting. From anandology at gmail.com Tue Dec 20 06:02:24 2011 From: anandology at gmail.com (Anand Chitipothu) Date: Tue, 20 Dec 2011 10:32:24 +0530 Subject: [BangPypers] Naming python packages Message-ID: Hi, I've noticed that pip converts underscore in the package name to hyphen. $ pip install satchmo_indiapost Downloading/unpacking satchmo-indiapost Could not find any downloads that satisfy the requirement satchmo-indiapost No distributions at all found for satchmo-indiapost There is a packge with requested name on pypi, but pip doesn't even looking for it. http://pypi.python.org/pypi/satchmo_indiapost Is underscore prohibited in the package names? I usually find it convenient to name the package name same as the python module. But I've seen people using CamelCase for package names like Sphinx, Flask etc. Are there any known guidelines for naming python packages uploaded to pypi? Anand From baiju.m.mail at gmail.com Tue Dec 20 06:35:49 2011 From: baiju.m.mail at gmail.com (Baiju M) Date: Tue, 20 Dec 2011 11:05:49 +0530 Subject: [BangPypers] Naming python packages In-Reply-To: References: Message-ID: On Tue, Dec 20, 2011 at 10:32 AM, Anand Chitipothu wrote: > Hi, > > I've noticed that pip converts underscore in the package name to hyphen. > > $ pip install satchmo_indiapost > Downloading/unpacking satchmo-indiapost > ?Could not find any downloads that satisfy the requirement satchmo-indiapost > No distributions at all found for satchmo-indiapost > > There is a packge with requested name on pypi, but pip doesn't even > looking for it. > > http://pypi.python.org/pypi/satchmo_indiapost > > Is underscore prohibited in the package names? Check the PJE's replies here: http://mail.python.org/pipermail/distutils-sig/2010-March/thread.html#15641 -- Baiju M From anandology at gmail.com Tue Dec 20 07:22:28 2011 From: anandology at gmail.com (Anand Chitipothu) Date: Tue, 20 Dec 2011 11:52:28 +0530 Subject: [BangPypers] Naming python packages In-Reply-To: References: Message-ID: 2011/12/20 Baiju M : > On Tue, Dec 20, 2011 at 10:32 AM, Anand Chitipothu wrote: >> Hi, >> >> I've noticed that pip converts underscore in the package name to hyphen. >> >> $ pip install satchmo_indiapost >> Downloading/unpacking satchmo-indiapost >> ?Could not find any downloads that satisfy the requirement satchmo-indiapost >> No distributions at all found for satchmo-indiapost >> >> There is a packge with requested name on pypi, but pip doesn't even >> looking for it. >> >> http://pypi.python.org/pypi/satchmo_indiapost >> >> Is underscore prohibited in the package names? > > Check the PJE's replies here: > http://mail.python.org/pipermail/distutils-sig/2010-March/thread.html#15641 Quoting PJE: "It's a valid project name character; what it's not is a *canonical* project name character." What is this *canonical* project name? Does it mean underscore should be avoided in the project-name for all practical purposes? Anand From baiju.m.mail at gmail.com Tue Dec 20 07:47:43 2011 From: baiju.m.mail at gmail.com (Baiju M) Date: Tue, 20 Dec 2011 12:17:43 +0530 Subject: [BangPypers] Naming python packages In-Reply-To: References: Message-ID: On Tue, Dec 20, 2011 at 11:52 AM, Anand Chitipothu wrote: > 2011/12/20 Baiju M : >> On Tue, Dec 20, 2011 at 10:32 AM, Anand Chitipothu wrote: >>> Hi, >>> >>> I've noticed that pip converts underscore in the package name to hyphen. >>> >>> $ pip install satchmo_indiapost >>> Downloading/unpacking satchmo-indiapost >>> ?Could not find any downloads that satisfy the requirement satchmo-indiapost >>> No distributions at all found for satchmo-indiapost >>> >>> There is a packge with requested name on pypi, but pip doesn't even >>> looking for it. >>> >>> http://pypi.python.org/pypi/satchmo_indiapost >>> >>> Is underscore prohibited in the package names? >> >> Check the PJE's replies here: >> http://mail.python.org/pipermail/distutils-sig/2010-March/thread.html#15641 > > Quoting PJE: > > "It's a valid project name character; what it's not is a *canonical* > project name character." > > What is this *canonical* project name? > > Does it mean underscore should be avoided in the project-name for all > practical purposes? Well, I tried to point out this issue (as you can see in the long thread), but I couldn't succeed, then I stopped using underscore :) Please send your concerns to "distutils-sig". Regards, Baiju M using From prataprc at gmail.com Tue Dec 20 08:11:55 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Tue, 20 Dec 2011 12:41:55 +0530 Subject: [BangPypers] Naming python packages In-Reply-To: References: Message-ID: >> Does it mean underscore should be avoided in the project-name for all >> practical purposes? > > Well, I tried to point out this issue (as you can see in the long thread), > but I couldn't succeed, then I stopped using underscore :) I attempted a similar reply and then saw your original reply, on the python mailing list, was more or less on the same line. Looks like python extends dynamism to naming conventions as well :) ... From nitin.nitp at gmail.com Tue Dec 20 18:27:07 2011 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Tue, 20 Dec 2011 22:57:07 +0530 Subject: [BangPypers] colored o/p Message-ID: Hi All, I am trying to format o/p (colored bold string) on console. say IDLE or python command prompt using python modules. Please help me with an example. -- Nitin K From noufal at gmail.com Tue Dec 20 18:41:47 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 20 Dec 2011 23:11:47 +0530 Subject: [BangPypers] colored o/p In-Reply-To: (Nitin Kumar's message of "Tue, 20 Dec 2011 22:57:07 +0530") References: Message-ID: <87k45rqgx0.fsf@sanitarium.localdomain> Nitin Kumar writes: > Hi All, > > I am trying to format o/p (colored bold string) on console. say IDLE or > python command prompt using python modules. You *can* use curses (or the newly released blessings[1]) library. There are also a few recipes on activestate to do this. I remember using one of them a few years ago but don't remember which. http://code.activestate.com/recipes/574451-handling-ansi-terminal/ http://code.activestate.com/recipes/475116-using-terminfo-for-portable-color-output-cursor-co/ http://code.activestate.com/recipes/576503-linux-terminal-color-setter/ [...] Footnotes: [1] http://pypi.python.org/pypi/blessings -- ~noufal http://nibrahim.net.in Assume a virtue, if you have it not. -William Shakespeare From amit.pureenergy at gmail.com Wed Dec 21 09:04:12 2011 From: amit.pureenergy at gmail.com (Amit Sethi) Date: Wed, 21 Dec 2011 13:34:12 +0530 Subject: [BangPypers] procmail and python Message-ID: Has anybody here used some kind of python script with procmail . I want to set up a script that looks at a certain words in a mail and forwards it to users. However I am not able to understand how can I read the message in python script. The documentation suggests something like this should send the body and header to the stdin of my script but what I get some gibbresh text. :0 bh | /usr/bin/python /home/amit/work/scripts/respond.py Any ideas ?? -- A-M-I-T S|S From amit.pureenergy at gmail.com Wed Dec 21 09:11:01 2011 From: amit.pureenergy at gmail.com (Amit Sethi) Date: Wed, 21 Dec 2011 13:41:01 +0530 Subject: [BangPypers] procmail and python In-Reply-To: References: Message-ID: I think I should mention that i am fetching mail from gmail. Is there an encryption that google uses . Also the mails are being received fine on mutt. -- A-M-I-T S|S From noufal at gmail.com Wed Dec 21 09:43:09 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 21 Dec 2011 14:13:09 +0530 Subject: [BangPypers] procmail and python In-Reply-To: (Amit Sethi's message of "Wed, 21 Dec 2011 13:34:12 +0530") References: Message-ID: <87vcpanwma.fsf@sanitarium.localdomain> Amit Sethi writes: > Has anybody here used some kind of python script with procmail . I > want to set up a script that looks at a certain words in a mail and > forwards it to users. However I am not able to understand how can I > read the message in python script. > > The documentation suggests something like this should send the body > and header to the stdin of my script but what I get some gibbresh > text. > > :0 bh > | /usr/bin/python /home/amit/work/scripts/respond.py > > Any ideas ?? Ah the smell of old school UNIX at lunchtime. Most of my procmail fu has evaporated but I'll try. I'm not sure if procmail allows the "interpreter filename" spec. You'll probably have to make your .py script executable and then use a #! on top. Touch a file in /tmp inside your script to make sure that it's running when mails are received. Try that. But why involve Python in this at all? You can use something like :0 B word1|word2|word3 ! forward at example.com to do the actual pattern matching and forwarding can't you? -- ~noufal http://nibrahim.net.in Of course I can keep secrets. It's the people I tell them to that can't keep them. -Anthony Haden-Guest From noufal at gmail.com Wed Dec 21 09:43:46 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 21 Dec 2011 14:13:46 +0530 Subject: [BangPypers] procmail and python In-Reply-To: (Amit Sethi's message of "Wed, 21 Dec 2011 13:41:01 +0530") References: Message-ID: <87r4zynwl9.fsf@sanitarium.localdomain> Amit Sethi writes: > I think I should mention that i am fetching mail from gmail. Is there > an encryption that google uses . Also the mails are being received > fine on mutt. Yes but if you're fetching them, then you've gotten that part working. How are you fetching your emails? fetchmail? -- ~noufal http://nibrahim.net.in A verbal contract isn't worth the paper it's written on. Include me out. -Samuel Goldwyn From amit.pureenergy at gmail.com Wed Dec 21 09:59:48 2011 From: amit.pureenergy at gmail.com (Amit Sethi) Date: Wed, 21 Dec 2011 14:29:48 +0530 Subject: [BangPypers] procmail and python In-Reply-To: <87r4zynwl9.fsf@sanitarium.localdomain> References: <87r4zynwl9.fsf@sanitarium.localdomain> Message-ID: Well I am fairly sure the script is running i am simply writing the message in stdin to a log and that part works fine . Just looking at it again I think its an encoding because in the "gibbrish" message I have found some kind of dkim message thing : "(PST)#012DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;#012 d=gmail.com; s=gamma;#012 h=mime-version:from:date:message-id:subject:to:content-type;#012 bh=btU8zMPYA7hH3KInTTom2Ol8x6CN98Ney2nak/czdsk=;#012 b=FxoBb7SBclhSTNKmFX6lsnn5Pa98CBRFkQcZXIQ7M4sv7q2P1lumkt9a/PmuSSM9kn#012 gphgCSR2DYYRiscRo7vka3/T7Cw5k3EDbxUDolsSXZsAmEJWfGujX91fX+2VFxoaEFGT#012 lKTv6O1RCX8GOI+96KUUeThn21klF4BOVnYbs=#012Received: by 10.182.74.66 with SMTP id r2mr4721506obv.67.1324453960122; Tue,#012 20 Dec 2011 23:52:40 -0800 (PST)#012 " Yes , I am using Fetchmail to fetch the mails. -- A-M-I-T S|S From amit.pureenergy at gmail.com Wed Dec 21 12:43:50 2011 From: amit.pureenergy at gmail.com (Amit Sethi) Date: Wed, 21 Dec 2011 17:13:50 +0530 Subject: [BangPypers] Python's stdin buffer size Message-ID: Hi , I am trying to read in a large message piped to a python script. The message would have something like 1000 words . How can one increase the buffer size of sys.stdin in python. -- A-M-I-T S|S From noufal at gmail.com Wed Dec 21 16:15:55 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Wed, 21 Dec 2011 20:45:55 +0530 Subject: [BangPypers] Python's stdin buffer size In-Reply-To: (Amit Sethi's message of "Wed, 21 Dec 2011 17:13:50 +0530") References: Message-ID: <87fwgelzv8.fsf@sanitarium.localdomain> Amit Sethi writes: > Hi , I am trying to read in a large message piped to a python script. > The message would have something like 1000 words . How can one > increase the buffer size of sys.stdin in python. What's the problem with just a body = sys.stdin.read() and then processing body? -- ~noufal http://nibrahim.net.in All generalisations are dangerous, including this one. From senthil at uthcode.com Wed Dec 21 16:28:24 2011 From: senthil at uthcode.com (Senthil Kumaran) Date: Wed, 21 Dec 2011 23:28:24 +0800 Subject: [BangPypers] Python's stdin buffer size In-Reply-To: References: Message-ID: On Wed, Dec 21, 2011 at 7:43 PM, Amit Sethi wrote:> Hi , I am trying to read in a large message piped to a python script.> The message would have something like 1000 words . How can one> increase the buffer size of sys.stdin in python. For 1000 words, your python program wont have any problem. PIPE is a OS property and Operating System kernel will take care of buffering enough of data so that your consuming python program can read. That's how it operates in Python 2.7 where the input size is effectively managed by OS kernel. >From 3.x onwards, a buffered reader class is provided by Cpython, wherein you can give an argument to sys.stdin.buffer.read(200000) which would read that many bytes. If you are not using 3.x, perhaps you may not care of about this. Senthil From sajuptpm at gmail.com Thu Dec 22 06:46:46 2011 From: sajuptpm at gmail.com (Saju M) Date: Thu, 22 Dec 2011 00:46:46 -0500 Subject: [BangPypers] unfortunate-python Message-ID: http://excess.org/article/2011/12/unfortunate-python/ -- Saju Madhavan saju at fluentsoft.com +91 09535134654 From nitin.nitp at gmail.com Thu Dec 22 11:28:58 2011 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Thu, 22 Dec 2011 15:58:58 +0530 Subject: [BangPypers] Reading registry keys Message-ID: Hi All, I am in learning phase to handle registry keys and manipulate it. I guess we can use winreg as well as win32com for the same purpose. can anyone please tell me the difference in their usage. -- Nitin K From noufal at gmail.com Thu Dec 22 11:46:05 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Thu, 22 Dec 2011 16:16:05 +0530 Subject: [BangPypers] Reading registry keys In-Reply-To: (Nitin Kumar's message of "Thu, 22 Dec 2011 15:58:58 +0530") References: Message-ID: <87wr9olw9e.fsf@sanitarium.localdomain> Nitin Kumar writes: > Hi All, > > I am in learning phase to handle registry keys and manipulate it. > I guess we can use winreg as well as win32com for the same purpose. > > can anyone please tell me the difference in their usage. winreg is a part of the standard library on windows that allows you to access the registry. I haven't used it but if registry manipulation was what I wanted to do and this worked, I would use this. win32com is a more general 3rd party module that gives you access to native windows libraries from within Python. Sort of a windows only ctypes-lite. I've used it a little to access some GUI functions. -- ~noufal http://nibrahim.net.in Monotheism is a gift from the gods. From rahul8590 at gmail.com Thu Dec 22 13:05:08 2011 From: rahul8590 at gmail.com (Rahul R) Date: Thu, 22 Dec 2011 17:35:08 +0530 Subject: [BangPypers] In Multiprocess module how to find which worker process is executing the job Message-ID: I was wondering , if there is a way to find out which process among the Pool has executed a particular job submitted. For example , def start_exe(): ##Does some task ### if __name__ == '__main__': p = Pool(5) result = p.apply_async(start_exe) print result.get() how do i find out , which worker process from the Pool has executed the job. Regards, Rahul From senthil at uthcode.com Thu Dec 22 15:25:41 2011 From: senthil at uthcode.com (Senthil Kumaran) Date: Thu, 22 Dec 2011 22:25:41 +0800 Subject: [BangPypers] colored o/p In-Reply-To: <87k45rqgx0.fsf@sanitarium.localdomain> References: <87k45rqgx0.fsf@sanitarium.localdomain> Message-ID: <20111222142541.GA3994@mathmagic> > Nitin Kumar writes: > > > I am trying to format o/p (colored bold string) on console. say IDLE or > > python command prompt using python modules. urwid is a library which can handle those for you. Give a try! It is very close to what ncurses can be used for. HTH, Senthil From kracethekingmaker at gmail.com Thu Dec 22 16:28:09 2011 From: kracethekingmaker at gmail.com (kracekumar ramaraju) Date: Thu, 22 Dec 2011 20:58:09 +0530 Subject: [BangPypers] colored o/p In-Reply-To: <20111222142541.GA3994@mathmagic> References: <87k45rqgx0.fsf@sanitarium.localdomain> <20111222142541.GA3994@mathmagic> Message-ID: Hi I have achieved same using colorma. -- * Thanks & Regards "Talk is cheap, show me the code" -- Linus Torvalds kracekumar www.kracekumar.com * From nikunjbadjatya at gmail.com Thu Dec 22 17:04:03 2011 From: nikunjbadjatya at gmail.com (Nikunj Badjatya) Date: Thu, 22 Dec 2011 21:34:03 +0530 Subject: [BangPypers] Auto Login to Website and Capturing more details Message-ID: Hi All, I am trying to use Python power in my daily life. Do you have Airtel Broadband Connection ? YES / NO ? In either case..read on. ! I am trying to write a script which will automatically login to Airtel page https://ebpp.airtelworld.com/cares/wps/myportal Then go to "account information -> -> View Unbilled Information" And prints the details of unbilled information. Can anyone guide me on this.? How to start etc. The site is definitely javascript based ( Please correct if I am wrong! ) Note: ( I want this because we, myself and my flatmates have a "limited data plan" and after reaching that limit the speed decreases. :P I checked with Airtel guys and they said they dnt give daily usage alerts to customers. You have to login everyday and check. ! And so this script plan. ) I will later add this script in cron job to send mail everyday to all users of my broadband. Thanks, Nikunj -- *7*Switch off as you go |*q*Recycle always | P Save Paper - Save Trees | Go Green From noufal at gmail.com Thu Dec 22 17:57:20 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Thu, 22 Dec 2011 22:27:20 +0530 Subject: [BangPypers] Auto Login to Website and Capturing more details In-Reply-To: (Nikunj Badjatya's message of "Thu, 22 Dec 2011 21:34:03 +0530") References: Message-ID: <877h1olf2n.fsf@sanitarium.localdomain> Nikunj Badjatya writes: > Hi All, > > I am trying to use Python power in my daily life. > Do you have Airtel Broadband Connection ? YES / NO ? In either case..read > on. ! > I am trying to write a script which will automatically login to Airtel page > https://ebpp.airtelworld.com/cares/wps/myportal > Then go to "account information -> -> View Unbilled > Information" > And prints the details of unbilled information. > > Can anyone guide me on this.? How to start etc. > The site is definitely javascript based ( Please correct if I am > wrong! ) You're probably right. People just love to use JS to make their sites "Web 2.0" these days but it's something we screen scrapers have to deal with. Here are my comments from a quick examination using Firebug (which is something you should have handy to investigate stuff like this). The login attempt POSTs your data to https://ebpp.airtelworld.com/pkmslogin.form which returns a secure cookie that should probably be sent in subsequent requests to handle your session. This is probably the first thing you need to do. The Python stdlib can handle this using urllib2 and cookielib. I've managed something like this here https://gist.github.com/3811b566df4005a012c7 which you can use as a starting point. After this, you have a session. Now you should be able to GET the URL you want directly and parse it for the information you need. [...] -- ~noufal http://nibrahim.net.in Evil isn't all bad. From saager.mhatre at gmail.com Thu Dec 22 20:59:44 2011 From: saager.mhatre at gmail.com (Saager Mhatre) Date: Fri, 23 Dec 2011 01:29:44 +0530 Subject: [BangPypers] Auto Login to Website and Capturing more details In-Reply-To: <877h1olf2n.fsf@sanitarium.localdomain> References: <877h1olf2n.fsf@sanitarium.localdomain> Message-ID: On Thu, Dec 22, 2011 at 10:27 PM, Noufal Ibrahim wrote: > [snip] > > The Python stdlib can handle this using urllib2 and cookielib. I've managed > something like this here https://gist.github.com/3811b566df4005a012c7which you can use as a starting point. > > After this, you have a session. Now you should be able to GET the URL you > want directly and parse it for the information you need. > Wouldn't something like mechanize simplify all this? - d From brian at python.org Fri Dec 23 03:00:40 2011 From: brian at python.org (Brian Curtin) Date: Thu, 22 Dec 2011 20:00:40 -0600 Subject: [BangPypers] PyCon 2012 News - Tutorials, Talks, and Tickets Message-ID: <4EF3E0C8.6080605@python.org> We are now 75 days away from PyCon 2012 in Santa Clara?it?s hard to think about how quickly time has flown since PyCon 2011! We?ve lined up some great keynote and plenary speakers, announced the tutorial and talk selections, opened ticket sales, and have expanded financial aid opportunities. The community and our amazing array of sponsors have helped us break several records already, so we hope you?re as excited about PyCon 2012 as we are. The conference runs March 7-15 at the Santa Clara Convention Center in Santa Clara, CA. The keynote speakers include Y Combinator investor Paul Graham and Mozilla?s Head of Developer Engagement, Stormy Peters. Both of them bring interesting experience to the table, and they?re both captivating speakers. Speaking of captivating, Dave Beazley was announced on the plenary track, with more to be added in the coming weeks. Guido?our Benevolent Dictator For Life?will also be joining the line up! With 483 tutorial, talk, and poster proposals submitted this year, the program committee had their hands full paring that list down to 95 talks, 32 tutorials, and 36 posters (which we?re still accepting). In the little time since we made these announcements we?ve heard a lot of excitement. You can see the tutorial selections at https://us.pycon.org/2012/schedule/lists/tutorials/, with talks available at https://us.pycon.org/2012/schedule/lists/talks/. Tickets are now available with early bird rates available until January 10, 2012 at https://us.pycon.org/2012/registration. Tutorial and admission prices continue unchanged; if you?ve been following along the last few years, these rates are the same as they have been for several years. Our team?s dedication to keeping PyCon cost-effective, community driven, and grassroots continues thank to the hard work and support of the team and sponsors (https://us.pycon.org/2012/sponsors/). If financial assistance would make PyCon a possibility for you, we encourage you to apply to this year?s expanded assistance program. With a deadline of January 7, 2012 (extended from January 2) and a new web-based application, the financial aid committee aims to make the trip, lodging, and a ticket a possibility for everyone. Thanks to a new partnership with the PyLadies organization, we?re able to provide grants to women in the community who are interested in experiencing the conference. For full details see https://us.pycon.org/2012/assistance. For more information about PyCon 2012, see our site at https://us.pycon.org/2012/. We also publish news on our blog: http://pycon.blogspot.com/. Jesse Noller - Chairman jnoller at python.org Brian Curtin - Publicity Coordinator brian at python.org From amit.pureenergy at gmail.com Fri Dec 23 12:31:06 2011 From: amit.pureenergy at gmail.com (Amit Sethi) Date: Fri, 23 Dec 2011 17:01:06 +0530 Subject: [BangPypers] Text/Mail filtering/classification using python Message-ID: Hi All, I am looking for a spam filtering/classification solution . The essential requirement are : 1. Return a negative on all text with certain words. But apart from returning negative on certain words. I want it to be able to classify certain positives. For ex - Given the fact that [Sachin, Cricket, Batsmen] are related to cricket - returns a positive on cricket Given the fact that [ Inflation, Share Price ] are related to Finance - returns a positive on finance etc ... What kind of tool set/ library can help me achieve that ? -- A-M-I-T S|S From wah_meng at yahoo.com Fri Dec 23 12:33:42 2011 From: wah_meng at yahoo.com (Wah Meng Wong) Date: Fri, 23 Dec 2011 03:33:42 -0800 (PST) Subject: [BangPypers] My VB EXE can't make calls to Python Servers via OLE RMI technology (application was writen in the 90s) In-Reply-To: References: Message-ID: <1324640022.54568.YahooMailNeo@web30402.mail.mud.yahoo.com> Hello there, ? I am in the midst of migrating my client server applications (RMI as middleware) from python 1.5.2 to python 2.7.1. I have done up the migration on my application servers writen in pure python that runs on the UNIX platform. No issue. ? Now I am encountering an issue where my client which is writen in VB EXE (using OLE RMI technology, or COM method), unable to call the application servers on UNIX successfully. The?stack trace reveals that it gets stuck at this code, a TIMEOUT error is returned. It looks like it failes to invoke a COM method and the code that triggers it resides in win32com\server\policy.py file. ? My client program is run on Windows 7, and I haven't tried on Windows XP and I will try that out next week to see if I encounter the same problem. ? Does anyone know if this is related to the TCP RMI call to?10.228.70.137:26000 daemon process, or it is some kind of privilege (like UAC thing in Windows 7), or security policy depicted in the policy.py perhaps?? ? Hope to hear some insights on this. Thanks!? ?Collecting Python Trace Output... Proxy called with: MatlMgr, getCompatibleFTCSVersions(), (), {} Dec 23 18:41:21 OleRmiClient???? Timeout of 300 seconds occurred on the invocati on of ('getAppAddress', (u'MatlMgr',), {}) to ('10.228.70.137', 26000) pythoncom error: Python error invoking COM method. ? Traceback (most recent call last): ? File "C:\genesis\Enablers\Python\lib\site-packages\win32com\server\policy.py", ?line 277, in _Invoke_ ??? return self._invoke_(dispid, lcid, wFlags, args) ? File "C:\genesis\Enablers\Python\lib\site-packages\win32com\server\policy.py", ?line 282, in _invoke_ ??? return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, args, None, None) ? File "C:\genesis\Enablers\Python\lib\site-packages\win32com\server\policy.py", ?line 585, in _invokeex_ ??? return func(*args) ? File "C:\genesis\Product\Lib\PythonOleRmi.py", line 240, in Proxy ??? proxy = self._getProxyObj(pyserverString) ? File "C:\genesis\Product\Lib\PythonOleRmi.py", line 223, in _getProxyObj ??? None, self._logWriter, rem_admin_addr = remAddr ) ? File "C:\genesis\Product\Lib\EComponent.py", line 710, in __init__ ??? addr = self._getAppProxyAddress() ? File "C:\genesis\Product\Lib\EComponent.py", line 742, in _getAppProxyAddress ??? addr = remAdmin.getAppAddress(self.server_name) ? File "C:\genesis\Product\Lib\EComponent.py", line 611, in __call__ ??? self._method, args, kw ) ? File "C:\genesis\Product\Lib\RMI.py", line 1779, in _genericInvocation ??? reply = self._requestReply( replyBit, (method_name, args, kw) ) ? File "C:\genesis\Product\Lib\RMI.py", line 1585, in _requestReply ??? reply = self._receive() ? File "C:\genesis\Product\Lib\RMI.py", line 1677, in _receive ??? raise ServerReplyTimeout( self.reply_timeout) ServerReplyTimeout: 300 From b.ghose at gmail.com Fri Dec 23 12:37:23 2011 From: b.ghose at gmail.com (Baishampayan Ghose) Date: Fri, 23 Dec 2011 17:07:23 +0530 Subject: [BangPypers] Text/Mail filtering/classification using python In-Reply-To: References: Message-ID: You need a Naive Bayes Classifier. Take a look at PyZor - http://sourceforge.net/apps/trac/pyzor/ Regards, BG On Fri, Dec 23, 2011 at 5:01 PM, Amit Sethi wrote: > Hi All, I am looking for a spam filtering/classification solution . > > The essential requirement are : > 1. Return a negative on all text with certain words. > > But apart from returning negative on certain words. I want it to be able to > classify certain positives. > > For ex - Given the fact that [Sachin, Cricket, Batsmen] are related to > cricket - returns a positive on cricket > Given the fact that [ Inflation, Share Price ] are related to Finance - > returns a positive on finance > > etc ... What kind of tool set/ library can help me achieve that ? > > -- > A-M-I-T S|S > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Baishampayan Ghose b.ghose at gmail.com From jaganadhg at gmail.com Fri Dec 23 13:21:28 2011 From: jaganadhg at gmail.com (JAGANADH G) Date: Fri, 23 Dec 2011 17:51:28 +0530 Subject: [BangPypers] Text/Mail filtering/classification using python In-Reply-To: References: Message-ID: Hi You can use skikits.learn or nltk for the task. Both tools give good support for the same . Also implementing a bays classifier is pretty simple too -- ********************************** JAGANADH G http://jaganadhg.in *ILUGCBE* http://ilugcbe.org.in From wah_meng at yahoo.com Sat Dec 24 05:26:02 2011 From: wah_meng at yahoo.com (Wah Meng) Date: Sat, 24 Dec 2011 12:26:02 +0800 Subject: [BangPypers] My VB exe client application can't all a python API Message-ID: <38447854-1DF7-4EEA-BC67-178CB3EAE95C@yahoo.com> I am in the midst of migrating my client server applications (RMI as middleware) from python 1.5.2 to python 2.7.1. I have done up the migration on my application servers writen in pure python that runs on the UNIX platform. No issue. Now I am encountering an issue where my client which is writen in VB EXE (using OLE RMI technology, or COM method), unable to call the application servers on UNIX successfully. The stack trace reveals that it gets stuck at this code, a TIMEOUT error is returned. It looks like it failes to invoke a COM method and the code that triggers it resides in win32com\server\policy.py file. My client program is run on Windows 7, and I haven't tried on Windows XP and I will try that out next week to see if I encounter the same problem. Does anyone know if this is related to the TCP RMI call to 10.228.70.137:26000 daemon process, or it is some kind of privilege (like UAC thing in Windows 7), or security policy depicted in the policy.py perhaps? Hope to hear some insights on this. Thanks! Collecting Python Trace Output... Proxy called with: MatlMgr, getCompatibleFTCSVersions(), (), {} Dec 23 18:41:21 OleRmiClient Timeout of 300 seconds occurred on the invocati on of ('getAppAddress', (u'MatlMgr',), {}) to ('10.228.70.137', 26000) pythoncom error: Python error invoking COM method. Traceback (most recent call last): File "C:\genesis\Enablers\Python\lib\site-packages\win32com\server\policy.py", line 277, in _Invoke_ return self._invoke_(dispid, lcid, wFlags, args) File "C:\genesis\Enablers\Python\lib\site-packages\win32com\server\policy.py", line 282, in _invoke_ return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, args, None, None) File "C:\genesis\Enablers\Python\lib\site-packages\win32com\server\policy.py", line 585, in _invokeex_ Regards, Wah Meng From sss at tradus.in Sat Dec 24 15:36:08 2011 From: sss at tradus.in (Sandeep Srinivasa) Date: Sat, 24 Dec 2011 20:06:08 +0530 Subject: [BangPypers] [Commercial] cool internship in ERP, supply chain at a top-10 ecommerce venture Message-ID: hi, We are looking for Tradus - one of india's largest ecommerce initiatives (incidentally, we are owned by Naspers which owns a large chunk of Facebook). We have some very cool projects in ERP, supply chain and CRM systems engineering and we are thinking of powering it using Python. So you'll be the architect as well as the developer rolled into one ! Benefits include best in industry stipends, flight tickets and all the pizza you can eat! Please do share your open source code repositories (github, bitbucket, etc. ) if you have any. thanks -Sandeep From lawgon at gmail.com Sun Dec 25 08:22:14 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Sun, 25 Dec 2011 12:52:14 +0530 Subject: [BangPypers] golf problem Message-ID: <1324797734.10514.26.camel@xlquest.web> hi, a golf course has 18 holes. There are three types of hole - par 3, par 4 and par 5. For a certain type of tournament it is necessary to generate a random list of 6 holes. The only condition is that this list should contain at least one of each type of hole. What would be an elegant way of doing this. Sample data for Ooty golf course is given below. The hole number is the first element of each tuple and the par is the second element. [(1, 5), (2, 3), (3, 4), (4, 4), (5, 5), (6, 4), (7, 3), (8, 4), (9, 3), (10, 4), (11, 3), (12, 4), (13, 4), (14, 3), (15, 4), (16, 5), (17, 4), (18, 4)] -- regards Kenneth Gonsalves From gora at mimirtech.com Sun Dec 25 09:39:05 2011 From: gora at mimirtech.com (Gora Mohanty) Date: Sun, 25 Dec 2011 14:09:05 +0530 Subject: [BangPypers] golf problem In-Reply-To: <1324797734.10514.26.camel@xlquest.web> References: <1324797734.10514.26.camel@xlquest.web> Message-ID: On Sun, Dec 25, 2011 at 12:52 PM, Kenneth Gonsalves wrote: > hi, > > a golf course has 18 holes. There are three types of hole - par 3, par 4 > and par 5. For a certain type of tournament it is necessary to generate > a random list of 6 holes. The only condition is that this list should > contain at least one of each type of hole. What would be an elegant way > of doing this. Sample data for Ooty golf course is given below. The hole > number is the first element of each tuple and the par is the second > element. http://pastebin.com/SSxkDCGW Regards, Gora From noufal at gmail.com Sun Dec 25 09:36:58 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Sun, 25 Dec 2011 14:06:58 +0530 Subject: [BangPypers] golf problem In-Reply-To: <1324797734.10514.26.camel@xlquest.web> (Kenneth Gonsalves's message of "Sun, 25 Dec 2011 12:52:14 +0530") References: <1324797734.10514.26.camel@xlquest.web> Message-ID: <87obuxgi8l.fsf@sanitarium.localdomain> Kenneth Gonsalves writes: > hi, > > a golf course has 18 holes. There are three types of hole - par 3, par 4 > and par 5. For a certain type of tournament it is necessary to generate > a random list of 6 holes. The only condition is that this list should > contain at least one of each type of hole. What would be an elegant way > of doing this. Sample data for Ooty golf course is given below. The hole > number is the first element of each tuple and the par is the second > element. I can think of a crude way. Keep a list of buckets (par 3, par 4 and par 5). Select one random hole from each bucket. Now your constraint is satisfied. Then just select 3 more from the whole set of holes (minus the three already selected) to get the total upto 6. [...] -- ~noufal http://nibrahim.net.in I disagree with unanimity. From b.ghose at gmail.com Sun Dec 25 10:23:19 2011 From: b.ghose at gmail.com (Baishampayan Ghose) Date: Sun, 25 Dec 2011 14:53:19 +0530 Subject: [BangPypers] golf problem In-Reply-To: <1324797734.10514.26.camel@xlquest.web> References: <1324797734.10514.26.camel@xlquest.web> Message-ID: > a golf course has 18 holes. There are three types of hole - par 3, par 4 > and par 5. For a certain type of tournament it is necessary to generate > a random list of 6 holes. The only condition is that this list should > contain at least one of each type of hole. What would be an elegant way > of doing this. Sample data for Ooty golf course is given below. The hole > number is the first element of each tuple and the par is the second > element. This is my solution - http://dpaste.org/wrgG8/ Mine is similar to Gora's solution, except that I have tried to maintain the actual probabilities of each par in the course and minimise the number of passes through the list. It shouldn't matter much for a small list though. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com From steve at lonetwin.net Sun Dec 25 09:36:36 2011 From: steve at lonetwin.net (steve) Date: Sun, 25 Dec 2011 14:06:36 +0530 Subject: [BangPypers] golf problem In-Reply-To: <1324797734.10514.26.camel@xlquest.web> References: <1324797734.10514.26.camel@xlquest.web> Message-ID: <4EF6E094.3060908@lonetwin.net> Hi, On 12/25/2011 12:52 PM, Kenneth Gonsalves wrote: > hi, > > a golf course has 18 holes. There are three types of hole - par 3, par 4 > and par 5. For a certain type of tournament it is necessary to generate > a random list of 6 holes. The only condition is that this list should > contain at least one of each type of hole. What would be an elegant way > of doing this. Sample data for Ooty golf course is given below. The hole > number is the first element of each tuple and the par is the second > element. > I am sorry, I didn't quite understand this bit "it is necessary to generate a random list of 6 holes.", since the list below has 18 elements. In any case, whether you need 6 or 18 -- the simplest way to do this would be: >>> l = [] >>> for i in range(6): ... l.append(random.choice([3,4,5])) ... >>> l [4, 5, 3, 4, 5, 5] # ...where the index is the hole number and the element is the par, or if you # need it in the format you showed: >>> l = [] >>> for i in range(1, 19): ... l.append((i, random.choice([3,4,5]))) ... >>> l [(1, 5), (2, 3), (3, 4), (4, 5), (5, 3), (6, 3), (7, 5), (8, 4), (9, 3), (10, 5), (11, 5), (12, 5), (13, 4), (14, 5), (15, 3), (16, 5), (17, 3), (18, 5)] >>> cheers, - steve -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupon.com/ From prataprc at gmail.com Mon Dec 26 05:31:30 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Mon, 26 Dec 2011 10:01:30 +0530 Subject: [BangPypers] golf problem In-Reply-To: <4EF6E094.3060908@lonetwin.net> References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> Message-ID: # Initialize variables holes, bk = HOLES[:], {} ; random.shuffle( holes ) # Make buckets [ bk.setdefault(y, []).append((x,y)) for x, y in holes ] # Result print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.sample( bk[3] + bk[4] + bk[5], 3 ) Some times the crude method is the best method ? A crude analysis on the above logic and number of passes made on the sample list. 1. To copy HOLES to holes 2. To shuffle holes using random.shuffle() 3. To make buckets 4. random.sample() is another crude algorithm which seems to be in between O(n) and O(n^2) - a wild guess. From lawgon at gmail.com Mon Dec 26 06:56:37 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Mon, 26 Dec 2011 11:26:37 +0530 Subject: [BangPypers] golf problem In-Reply-To: References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> Message-ID: <1324878997.2021.9.camel@xlquest.web> On Mon, 2011-12-26 at 10:01 +0530, Pratap Chakravarthy wrote: > # Initialize variables > holes, bk = HOLES[:], {} ; > random.shuffle( holes ) > > # Make buckets > [ bk.setdefault(y, []).append((x,y)) for x, y in holes ] > > # Result > print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.sample( > bk[3] + bk[4] + bk[5], 3 ) > > Some times the crude method is the best method ? > > A crude analysis on the above logic and number of passes made on the > sample list. > 1. To copy HOLES to holes > 2. To shuffle holes using random.shuffle() > 3. To make buckets > 4. random.sample() is another crude algorithm which seems to be in > between O(n) and O(n^2) - a wild guess. I am pasting Gora's and G0sub's solutions here as pastebins expire and the next golfer who searches this list will get confused. Gora: import random ALL_HOLES=[(1, 5), (2, 3), (3, 4), (4, 4), (5, 5), (6, 4), (7, 3), (8, 4), (9, 3), (10, 4), (11, 3), (12, 4), (13, 4), (14, 3), (15, 4), (16, 5), (17, 4), (18, 4)] PAR3_HOLES=[i for i in ALL_HOLES if i[1]==3] PAR4_HOLES=[i for i in ALL_HOLES if i[1]==4] PAR5_HOLES=[i for i in ALL_HOLES if i[1]==5] # Must allow at least 2 holes of par 4, and 5 n3 = random.randint( 1, 4 ) SEL_PAR3_HOLES = random.sample( PAR3_HOLES, n3 ) # Must allow at least 1 hole of par 5 n4 = random.randint( 1, 5 - n3 ) SEL_PAR4_HOLES = random.sample( PAR4_HOLES, n4 ) n5 = 6 - n4 - n3 SEL_PAR5_HOLES = random.sample( PAR5_HOLES, n5 ) # Selected values are in SEL_PAR3_HOLES, SEL_PAR4_HOLES, SEL_PAR5_HOLES print len( SEL_PAR3_HOLES ), len( SEL_PAR4_HOLES ), len( SEL_PAR5_HOLES ) G0sub: import random ALL_HOLES=[(1, 5), (2, 3), (3, 4), (4, 4), (5, 5), (6, 4), (7, 3), (8, 4), (9, 3), (10, 4), (11, 3), (12, 4), (13, 4), (14, 3), (15, 4), (16, 5), (17, 4), (18, 4)] PAR3_HOLES=[i for i in ALL_HOLES if i[1]==3] PAR4_HOLES=[i for i in ALL_HOLES if i[1]==4] PAR5_HOLES=[i for i in ALL_HOLES if i[1]==5] # Must allow at least 2 holes of par 4, and 5 n3 = random.randint( 1, 4 ) SEL_PAR3_HOLES = random.sample( PAR3_HOLES, n3 ) # Must allow at least 1 hole of par 5 n4 = random.randint( 1, 5 - n3 ) SEL_PAR4_HOLES = random.sample( PAR4_HOLES, n4 ) n5 = 6 - n4 - n3 SEL_PAR5_HOLES = random.sample( PAR5_HOLES, n5 ) # Selected values are in SEL_PAR3_HOLES, SEL_PAR4_HOLES, SEL_PAR5_HOLES print len( SEL_PAR3_HOLES ), len( SEL_PAR4_HOLES ), len( SEL_PAR5_HOLES ) -- regards Kenneth Gonsalves From lawgon at gmail.com Mon Dec 26 07:32:48 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Mon, 26 Dec 2011 12:02:48 +0530 Subject: [BangPypers] golf problem In-Reply-To: References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> Message-ID: <1324881168.2021.13.camel@xlquest.web> On Mon, 2011-12-26 at 10:01 +0530, Pratap Chakravarthy wrote: > # Initialize variables > holes, bk = HOLES[:], {} ; > random.shuffle( holes ) > > # Make buckets > [ bk.setdefault(y, []).append((x,y)) for x, y in holes ] > > # Result > print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.sample( > bk[3] + bk[4] + bk[5], 3 ) > > Some times the crude method is the best method ? perfect - you win a free golf lesson the next time you are in Ooty. -- regards Kenneth Gonsalves From gvkalra at gmail.com Mon Dec 26 08:39:15 2011 From: gvkalra at gmail.com (Gaurav Kalra) Date: Mon, 26 Dec 2011 13:09:15 +0530 Subject: [BangPypers] golf problem Message-ID: From: steve > I am sorry, I didn't quite understand this bit "it is necessary to generate a > random list of 6 holes.", since the list below has 18 elements. That means out of the 18 elements from the list, we need 6 random elements but with one constraint. > In any case, whether you need 6 or 18 -- the simplest way to do this would be: > > >>> l = [] > >>> for i in range(6): > ... ? ? l.append(random.choice([3,4,5])) random.choice([3,4,5]) may also possibly generate [3,3,4,3,4,3] (http://docs.python.org/library/random.html#random.choice), which violates our constraint. We need at least 1 occurrence of all the three elements. > ... > >>> l > [4, 5, 3, 4, 5, 5] > > # ...where the index is the hole number and the element is the par, or if you > # need it in the format you showed: > > >>> l = [] > >>> for i in range(1, 19): > ... ? ? l.append((i, random.choice([3,4,5]))) > ... > >>> l > [(1, 5), (2, 3), (3, 4), (4, 5), (5, 3), (6, 3), (7, 5), (8, 4), (9, 3), > (10, 5), (11, 5), (12, 5), (13, 4), (14, 5), (15, 3), (16, 5), (17, 3), (18, 5)] > >>> You are getting it wrong. e.g there is no hole (4,5) in the sample data. Every hole has a fixed par type and we can't randomly associate one hole with a par type (as above). -- Gaurav Kalra Mobile: +91-9717-620-649 Facebook: /gauravkalra Twitter: @gvkalra From vijay750 at gmail.com Mon Dec 26 10:52:22 2011 From: vijay750 at gmail.com (Vijay Ramachandran) Date: Mon, 26 Dec 2011 15:22:22 +0530 Subject: [BangPypers] Text/Mail filtering/classification using python Message-ID: Use scikit - we've found that it works better than the classifiers in nltk. For the spam/ham problem, I've heard (circa 2006!!) that naive bayes works as well as any other classifier. For the label classification problem, since there is dependency between words, some other classifier will probably out perform a naive bayesian. hth, Vijay -- Performance marketing on Twitter - http://www.wisdomtap.com/ From lawgon at gmail.com Mon Dec 26 11:05:40 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Mon, 26 Dec 2011 15:35:40 +0530 Subject: [BangPypers] golf problem In-Reply-To: References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> Message-ID: <1324893940.2021.15.camel@xlquest.web> On Mon, 2011-12-26 at 10:01 +0530, Pratap Chakravarthy wrote: > # Initialize variables > holes, bk = HOLES[:], {} ; > random.shuffle( holes ) > > # Make buckets > [ bk.setdefault(y, []).append((x,y)) for x, y in holes ] > > # Result > print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.sample( > bk[3] + bk[4] + bk[5], 3 ) > > Some times the crude method is the best method ? just curious - why do you and Noufal think this is a crude method? -- regards Kenneth Gonsalves From noufal at gmail.com Mon Dec 26 12:02:50 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Mon, 26 Dec 2011 16:32:50 +0530 Subject: [BangPypers] golf problem In-Reply-To: <1324893940.2021.15.camel@xlquest.web> (Kenneth Gonsalves's message of "Mon, 26 Dec 2011 15:35:40 +0530") References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> <1324893940.2021.15.camel@xlquest.web> Message-ID: <87vcp3fvdx.fsf@sanitarium.localdomain> Kenneth Gonsalves writes: [...] > just curious - why do you and Noufal think this is a crude method? I don't like special casing stuff and the 3 selections outside the "main" flow sticks out in my solution. -- ~noufal http://nibrahim.net.in Parting is such sweet sorrow. -William Shakespeare From prataprc at gmail.com Mon Dec 26 13:04:47 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Mon, 26 Dec 2011 17:34:47 +0530 Subject: [BangPypers] golf problem In-Reply-To: <87vcp3fvdx.fsf@sanitarium.localdomain> References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> <1324893940.2021.15.camel@xlquest.web> <87vcp3fvdx.fsf@sanitarium.localdomain> Message-ID: > I don't like special casing stuff and the 3 selections outside the> "main" flow sticks out in my solution. I guess that is right. Any logic that is outside the main flow breaks the beauty and create kludge. Attempted to solve the same problem using Erlang, and surprisingly what was looking like kludge in python perfectly blends with recursion and pattern-matching. Attached is the file. If you have erlang installed, $ escript golf.erl # To execute A note on the source, 1. Only lines 6-14 are part of the golf permutation logic. 2. Function main() provides execution entry point. 3. Function ootygames() provides the sample data. 4. Function shuffle() is copy paste of Knuth / Fischer - Yates shuffle algorithm And interestingly it takes just N+3 pass on the sample list (plus O(NlogN) for shuffle() ) .... Cheers, On Mon, Dec 26, 2011 at 4:32 PM, Noufal Ibrahim wrote: > Kenneth Gonsalves writes: > > > [...] > >> just curious - why do you and Noufal think this is a crude method? > > > -- > ~noufal > http://nibrahim.net.in > > Parting is such sweet sorrow. -William Shakespeare > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. From ramdaz at gmail.com Tue Dec 27 05:19:27 2011 From: ramdaz at gmail.com (Ramdas S) Date: Tue, 27 Dec 2011 09:49:27 +0530 Subject: [BangPypers] check printing with python Message-ID: Is there anyway to print a check online using Django/Python? I see a possibility of making PDF on the fly, and sending it to the printer, but I want some opinion From lawgon at gmail.com Tue Dec 27 06:56:56 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Tue, 27 Dec 2011 11:26:56 +0530 Subject: [BangPypers] golf problem In-Reply-To: References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> <1324893940.2021.15.camel@xlquest.web> <87vcp3fvdx.fsf@sanitarium.localdomain> Message-ID: <1324965416.2021.18.camel@xlquest.web> On Mon, 2011-12-26 at 17:34 +0530, Pratap Chakravarthy wrote: > Attached is the file. I think the attachment got stripped. -- regards Kenneth Gonsalves From noufal at gmail.com Tue Dec 27 07:29:22 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Dec 2011 11:59:22 +0530 Subject: [BangPypers] check printing with python In-Reply-To: (Ramdas S.'s message of "Tue, 27 Dec 2011 09:49:27 +0530") References: Message-ID: <87mxaezfwd.fsf@sanitarium.localdomain> Ramdas S writes: > Is there anyway to print a check online using Django/Python? > > I see a possibility of making PDF on the fly, and sending it to the > printer, but I want some opinion I think you'd have best control with a PDF but it might also be possible to create the page in HTML and use a print CSS[1]. I've never tried this to YMMV. [...] Footnotes: [1] http://www.alistapart.com/articles/goingtoprint/ -- ~noufal http://nibrahim.net.in May I ask a question? From noufal at gmail.com Tue Dec 27 07:29:28 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Dec 2011 11:59:28 +0530 Subject: [BangPypers] check printing with python In-Reply-To: (Ramdas S.'s message of "Tue, 27 Dec 2011 09:49:27 +0530") References: Message-ID: <87k45izfw7.fsf@sanitarium.localdomain> Ramdas S writes: > Is there anyway to print a check online using Django/Python? > > I see a possibility of making PDF on the fly, and sending it to the > printer, but I want some opinion I think you'd have best control with a PDF but it might also be possible to create the page in HTML and use a print CSS[1]. I've never tried this so YMMV. [...] Footnotes: [1] http://www.alistapart.com/articles/goingtoprint/ -- ~noufal http://nibrahim.net.in May I ask a question? From nitin.nitp at gmail.com Tue Dec 27 13:04:05 2011 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Tue, 27 Dec 2011 17:34:05 +0530 Subject: [BangPypers] win32com.client.Dispatch Message-ID: Hi All, Say I did x=win32com.client.Dispatch("{6BF52A52-394A-11d3-B153-00C04F79FAA6}") where the clsid used is for window media palyer. Now if i do: >>> dir(x) ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', '__getattr__', '__getitem__', '__init__', '__int__', '__len__', '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum_', '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_print_details_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_'] It won't show any function related to this specific dll. This happens with any COMObject. So, is there any way to find out what all functions can be used with this object. (or any doc to give more depth) -- Nitin K From thesujit at gmail.com Tue Dec 27 13:13:28 2011 From: thesujit at gmail.com (Sujit Ghosal) Date: Tue, 27 Dec 2011 17:43:28 +0530 Subject: [BangPypers] win32com.client.Dispatch In-Reply-To: References: Message-ID: Hi Nitin, Probably you can give a try to "COM Raider". That tool should expose the methods which are present for that specific Dispatch ID. However there is a tool (by MS), which will help you out to solve this issue. I don't remember the tool name exactly. But I suppose Google should be able to help you out here. Hope it helps. - Sujit On Tue, Dec 27, 2011 at 5:34 PM, Nitin Kumar wrote: > Hi All, > > Say I did > x=win32com.client.Dispatch("{6BF52A52-394A-11d3-B153-00C04F79FAA6}") > > where the clsid used is for window media palyer. > Now if i do: > >>> dir(x) > ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', > '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', > '__getattr__', '__getitem__', '__init__', '__int__', '__len__', > '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', > '__setitem__', '__str__', '_builtMethods_', '_enum_', > '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', > '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', > '_print_details_', '_proc_', '_unicode_to_string_', '_username_', > '_wrap_dispatch_'] > > It won't show any function related to this specific dll. This happens with > any COMObject. > So, is there any way to find out what all functions can be used with this > object. (or any doc to give more depth) > > -- > Nitin K > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From noufal at gmail.com Tue Dec 27 13:11:19 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Dec 2011 17:41:19 +0530 Subject: [BangPypers] win32com.client.Dispatch In-Reply-To: (Nitin Kumar's message of "Tue, 27 Dec 2011 17:34:05 +0530") References: Message-ID: <87ipl2i594.fsf@sanitarium.localdomain> Nitin Kumar writes: > Hi All, > > Say I did > x=win32com.client.Dispatch("{6BF52A52-394A-11d3-B153-00C04F79FAA6}") > > where the clsid used is for window media palyer. > Now if i do: >>>> dir(x) > ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', > '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', > '__getattr__', '__getitem__', '__init__', '__int__', '__len__', > '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', > '__setitem__', '__str__', '_builtMethods_', '_enum_', > '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', > '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', > '_print_details_', '_proc_', '_unicode_to_string_', '_username_', > '_wrap_dispatch_'] > > It won't show any function related to this specific dll. This happens with > any COMObject. > So, is there any way to find out what all functions can be used with this > object. (or any doc to give more depth) I remember that the __getattr__ of the object is overridden to lookup available functions and call them when you actually invoke the functions. It's been a while so I'm not totally sure. It's the same with ctypes. In [14]: from ctypes import cdll In [15]: so = cdll.LoadLibrary("libc.so.6") In [16]: so.printf Out[16]: <_FuncPtr object at 0x1f4de20> In [17]: so.something_nonsenical --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/noufal/github/nibrahim/openlibrary/ in () /usr/lib/python2.6/ctypes/__init__.pyc in __getattr__(self, name) 364 if name.startswith('__') and name.endswith('__'): 365 raise AttributeError(name) --> 366 func = self.__getitem__(name) 367 setattr(self, name, func) 368 return func /usr/lib/python2.6/ctypes/__init__.pyc in __getitem__(self, name_or_ordinal) 369 370 def __getitem__(self, name_or_ordinal): --> 371 func = self._FuncPtr((name_or_ordinal, self)) 372 if not isinstance(name_or_ordinal, (int, long)): 373 func.__name__ = name_or_ordinal AttributeError: /lib/x86_64-linux-gnu/libc.so.6: undefined symbol: something_nonsenical There's also some kind of caching in place so that the lookup is not necessary again In [19]: "scanf" in dir(so) Out[19]: False In [20]: so.scanf Out[20]: <_FuncPtr object at 0x22511f0> In [21]: "scanf" in dir(so) Out[21]: True This is with ctypes and as far as I know, it's similar to the win32com API. Thanks -- ~noufal http://nibrahim.net.in I tripped over a hole that was sticking up out of the ground. From prataprc at gmail.com Tue Dec 27 13:49:33 2011 From: prataprc at gmail.com (Pratap Chakravarthy) Date: Tue, 27 Dec 2011 18:19:33 +0530 Subject: [BangPypers] golf problem In-Reply-To: <1324965416.2021.18.camel@xlquest.web> References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> <1324893940.2021.15.camel@xlquest.web> <87vcp3fvdx.fsf@sanitarium.localdomain> <1324965416.2021.18.camel@xlquest.web> Message-ID: I have posted at, http://pastebin.com/BG6X70Sv I don't understand why or how it got stripped. Cheers, On Tue, Dec 27, 2011 at 11:26 AM, Kenneth Gonsalves wrote: > On Mon, 2011-12-26 at 17:34 +0530, Pratap Chakravarthy wrote: >> Attached is the file. > > I think the attachment got stripped. > -- > regards > Kenneth Gonsalves > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. From bhuvan.thaker at gmail.com Tue Dec 27 13:49:18 2011 From: bhuvan.thaker at gmail.com (bhuvan thaker) Date: Tue, 27 Dec 2011 18:19:18 +0530 Subject: [BangPypers] BangPypers Digest, Vol 52, Issue 26 In-Reply-To: References: Message-ID: I am looking for smart and beautiful coder to create a coming soon page from the design that is already made in PSD format. Individual need to have every good understanding and hands-on experience of a. Basic web standards like CSS 3 and HTML, HTML5, XHTML. b. Web technologies like Ajax and others like python, PHP, django, jquery etc... c. Understand different CMS platforms + basic SEO d. Understand integration of different social sites and other analytical tools. e. Understand cloud based tools for storage (database) and hosting of website and web application. f. Understand Flash, Photoshop, HTML editor and other DTP (optional but will be preferred) Please contact me if you are interest. Bhuvan On Tue, Dec 27, 2011 at 4:30 PM, wrote: > Send BangPypers mailing list submissions to > bangpypers at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/bangpypers > or, via email, send a message with subject or body 'help' to > bangpypers-request at python.org > > You can reach the person managing the list at > bangpypers-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of BangPypers digest..." > > > Today's Topics: > > 1. Re: golf problem (Noufal Ibrahim) > 2. Re: golf problem (Pratap Chakravarthy) > 3. check printing with python (Ramdas S) > 4. Re: golf problem (Kenneth Gonsalves) > 5. Re: check printing with python (Noufal Ibrahim) > 6. Re: check printing with python (Noufal Ibrahim) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 26 Dec 2011 16:32:50 +0530 > From: Noufal Ibrahim > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] golf problem > Message-ID: <87vcp3fvdx.fsf at sanitarium.localdomain> > Content-Type: text/plain; charset=us-ascii > > Kenneth Gonsalves writes: > > > [...] > > > just curious - why do you and Noufal think this is a crude method? > > I don't like special casing stuff and the 3 selections outside the > "main" flow sticks out in my solution. > > -- > ~noufal > http://nibrahim.net.in > > Parting is such sweet sorrow. -William Shakespeare > > > ------------------------------ > > Message: 2 > Date: Mon, 26 Dec 2011 17:34:47 +0530 > From: Pratap Chakravarthy > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] golf problem > Message-ID: > > > Content-Type: text/plain; charset="iso-8859-1" > > > I don't like special casing stuff and the 3 selections outside the> > "main" flow sticks out in my solution. > I guess that is right. Any logic that is outside the main flow breaks > the beauty > and create kludge. > > Attempted to solve the same problem using Erlang, and surprisingly what was > looking like kludge in python perfectly blends with recursion and > pattern-matching. > > Attached is the file. If you have erlang installed, > > $ escript golf.erl # To execute > > A note on the source, > 1. Only lines 6-14 are part of the golf permutation logic. > 2. Function main() provides execution entry point. > 3. Function ootygames() provides the sample data. > 4. Function shuffle() is copy paste of Knuth / Fischer - Yates shuffle > algorithm > > And interestingly it takes just N+3 pass on the sample list (plus O(NlogN) > for > shuffle() ) .... > > Cheers, > > On Mon, Dec 26, 2011 at 4:32 PM, Noufal Ibrahim wrote: > > Kenneth Gonsalves writes: > > > > > > [...] > > > >> just curious - why do you and Noufal think this is a crude method? > > > > > > -- > > ~noufal > > http://nibrahim.net.in > > > > Parting is such sweet sorrow. -William Shakespeare > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > -- > Pratap. > > ------------------------------ > > Message: 3 > Date: Tue, 27 Dec 2011 09:49:27 +0530 > From: Ramdas S > To: Bangalore Python Users Group - India > Subject: [BangPypers] check printing with python > Message-ID: > > > Content-Type: text/plain; charset=ISO-8859-1 > > Is there anyway to print a check online using Django/Python? > > I see a possibility of making PDF on the fly, and sending it to the > printer, but I want some opinion > > > ------------------------------ > > Message: 4 > Date: Tue, 27 Dec 2011 11:26:56 +0530 > From: Kenneth Gonsalves > To: bangpypers at python.org > Subject: Re: [BangPypers] golf problem > Message-ID: <1324965416.2021.18.camel at xlquest.web> > Content-Type: text/plain; charset="UTF-8" > > On Mon, 2011-12-26 at 17:34 +0530, Pratap Chakravarthy wrote: > > Attached is the file. > > I think the attachment got stripped. > -- > regards > Kenneth Gonsalves > > > > ------------------------------ > > Message: 5 > Date: Tue, 27 Dec 2011 11:59:22 +0530 > From: Noufal Ibrahim > To: ramdaz at gmail.com > Cc: Bangalore Python Users Group - India > Subject: Re: [BangPypers] check printing with python > Message-ID: <87mxaezfwd.fsf at sanitarium.localdomain> > Content-Type: text/plain; charset=us-ascii > > Ramdas S writes: > > > Is there anyway to print a check online using Django/Python? > > > > I see a possibility of making PDF on the fly, and sending it to the > > printer, but I want some opinion > > I think you'd have best control with a PDF but it might also be possible > to create the page in HTML and use a print CSS[1]. I've never tried this > to YMMV. > > [...] > > > > Footnotes: > [1] http://www.alistapart.com/articles/goingtoprint/ > > -- > ~noufal > http://nibrahim.net.in > > May I ask a question? > > > ------------------------------ > > Message: 6 > Date: Tue, 27 Dec 2011 11:59:28 +0530 > From: Noufal Ibrahim > To: ramdaz at gmail.com > Cc: Bangalore Python Users Group - India > Subject: Re: [BangPypers] check printing with python > Message-ID: <87k45izfw7.fsf at sanitarium.localdomain> > Content-Type: text/plain; charset=us-ascii > > Ramdas S writes: > > > Is there anyway to print a check online using Django/Python? > > > > I see a possibility of making PDF on the fly, and sending it to the > > printer, but I want some opinion > > I think you'd have best control with a PDF but it might also be possible > to create the page in HTML and use a print CSS[1]. I've never tried this > so YMMV. > > [...] > > > > Footnotes: > [1] http://www.alistapart.com/articles/goingtoprint/ > > -- > ~noufal > http://nibrahim.net.in > > May I ask a question? > > > ------------------------------ > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > > > End of BangPypers Digest, Vol 52, Issue 26 > ****************************************** > From noufal at gmail.com Tue Dec 27 13:56:11 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Dec 2011 18:26:11 +0530 Subject: [BangPypers] Coming soon page designer needed (was: BangPypers Digest, Vol 52, Issue 26) In-Reply-To: (bhuvan thaker's message of "Tue, 27 Dec 2011 18:19:18 +0530") References: Message-ID: <8762h2i36c.fsf_-_@sanitarium.localdomain> Please don't reply to digests. It's hard to follow the thread. Start a new thread for a new topic. Helps threading. If all you need is a "coming soon" page, do you really need all the things you've mentioned below? Sounds excessive. If you're not averse to using a third party service, consider http://launchrock.com/. You can create a launch page for free and use it rather than do one manually. P.S. This is the first email I've seen that's explictly asking for a "beautiful" coder to get work done. :) bhuvan thaker writes: > I am looking for smart and beautiful coder to create a coming soon > page from the design that is already made in PSD format. > > Individual need to have every good understanding and hands-on > experience of > > a. Basic web standards like CSS 3 and HTML, HTML5, XHTML. > b. Web technologies like Ajax and others like python, PHP, django, > jquery etc... > c. Understand different CMS platforms + basic SEO > d. Understand integration of different social sites and other > analytical tools. > e. Understand cloud based tools for storage (database) and hosting of > website and web application. > f. Understand Flash, Photoshop, HTML editor and other DTP (optional > but will be preferred) > > Please contact me if you are interest. > Bhuvan [...] -- ~noufal http://nibrahim.net.in As famous as the unknown soldier. From thatiparthysreenivas at gmail.com Tue Dec 27 15:51:24 2011 From: thatiparthysreenivas at gmail.com (Sreenivas Reddy T) Date: Tue, 27 Dec 2011 20:21:24 +0530 Subject: [BangPypers] Coming soon page designer needed (was: BangPypers Digest, Vol 52, Issue 26) In-Reply-To: <8762h2i36c.fsf_-_@sanitarium.localdomain> References: <8762h2i36c.fsf_-_@sanitarium.localdomain> Message-ID: > P.S. This is the first email I've seen that's explictly asking for a > ? ? "beautiful" coder to get work done. :) Haha...ROFL. Regards, Srinivas Reddy T. From nikunjbadjatya at gmail.com Tue Dec 27 16:58:22 2011 From: nikunjbadjatya at gmail.com (Nikunj Badjatya) Date: Tue, 27 Dec 2011 21:28:22 +0530 Subject: [BangPypers] Auto Login to Website and Capturing more details In-Reply-To: References: <877h1olf2n.fsf@sanitarium.localdomain> Message-ID: Noufal, I tried with : {{{ import urllib, urllib2, cookielib username = 'xxx' password = 'xxx' savepage = open('output.html', 'w') #cj = cookielib.CookieJar() #opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) login_data = urllib.urlencode({'username' : username, 'j_password' : password}) opener.open('https://ebpp.airtelworld.com/pkmslogin.form', login_data) resp = opener.open(' https://ebpp.airtelworld.com/cares/wps/myportal/!ut/p/.cmd/cs/.ce/7_0_A/.s/7_0_J5/_s.7_0_A/7_0_J5 ') savepage.write(resp.read()) savepage.close() }}} The link in the 'resp' is true to my knowledge. I checked it by logging in at diff times. Its coming the same every time and it is the link behind 'Account Information' which comes on the front page after logging in. When I open output.html, Its giving me the same login form i.e same looks as those of 'https://ebpp.airtelworld.com/pkmslogin.form' I tried with CookieJar() also. Same results. Any ideas? Thanks, Nikunj -- *7*Switch off as you go |*q*Recycle always | P Save Paper - Save Trees | Go Green On Fri, Dec 23, 2011 at 1:29 AM, Saager Mhatre wrote: > On Thu, Dec 22, 2011 at 10:27 PM, Noufal Ibrahim wrote: > > > [snip] > > > > > > The Python stdlib can handle this using urllib2 and cookielib. I've managed > > something like this here > https://gist.github.com/3811b566df4005a012c7which you can use as a > starting point. > > > > After this, you have a session. Now you should be able to GET the URL you > > want directly and parse it for the information you need. > > > > Wouldn't something like mechanize > simplify all this? > > - d > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From kracethekingmaker at gmail.com Tue Dec 27 17:37:19 2011 From: kracethekingmaker at gmail.com (kracekumar ramaraju) Date: Tue, 27 Dec 2011 22:07:19 +0530 Subject: [BangPypers] Auto Login to Website and Capturing more details In-Reply-To: References: <877h1olf2n.fsf@sanitarium.localdomain> Message-ID: Hi Try requests, this is possible with it, use authentications in requests. On Tue, Dec 27, 2011 at 9:28 PM, Nikunj Badjatya wrote: > Noufal, > > I tried with : > {{{ > import urllib, urllib2, cookielib > > username = 'xxx' > password = 'xxx' > > savepage = open('output.html', 'w') > > #cj = cookielib.CookieJar() > #opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) > > opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) > login_data = urllib.urlencode({'username' : username, 'j_password' : > password}) > opener.open('https://ebpp.airtelworld.com/pkmslogin.form', login_data) > > resp = opener.open(' > > https://ebpp.airtelworld.com/cares/wps/myportal/!ut/p/.cmd/cs/.ce/7_0_A/.s/7_0_J5/_s.7_0_A/7_0_J5 > ') > > savepage.write(resp.read()) > savepage.close() > > > }}} > > The link in the 'resp' is true to my knowledge. I checked it by logging in > at diff times. Its coming the same every time and it is the link behind > 'Account Information' which comes on the front page after logging in. > > When I open output.html, Its giving me the same login form i.e same looks > as those of 'https://ebpp.airtelworld.com/pkmslogin.form' > > I tried with CookieJar() also. Same results. > > Any ideas? > > Thanks, > > Nikunj > > > -- > *7*Switch off as you go |*q*Recycle always | P Save Paper - Save Trees | Go > Green > > > > On Fri, Dec 23, 2011 at 1:29 AM, Saager Mhatre >wrote: > > > On Thu, Dec 22, 2011 at 10:27 PM, Noufal Ibrahim > wrote: > > > > > [snip] > > > > > > > > > > The Python stdlib can handle this using urllib2 and cookielib. I've > managed > > > something like this here > > https://gist.github.com/3811b566df4005a012c7which you can use as a > > starting point. > > > > > > After this, you have a session. Now you should be able to GET the URL > you > > > want directly and parse it for the information you need. > > > > > > > Wouldn't something like mechanize > > simplify all this? > > > > - d > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- * Thanks & Regards "Talk is cheap, show me the code" -- Linus Torvalds kracekumar www.kracekumar.com * From noufal at gmail.com Tue Dec 27 18:15:09 2011 From: noufal at gmail.com (Noufal Ibrahim) Date: Tue, 27 Dec 2011 22:45:09 +0530 Subject: [BangPypers] Auto Login to Website and Capturing more details In-Reply-To: (Nikunj Badjatya's message of "Tue, 27 Dec 2011 21:28:22 +0530") References: <877h1olf2n.fsf@sanitarium.localdomain> Message-ID: <87r4zqey1u.fsf@sanitarium.localdomain> Nikunj Badjatya writes: [...] > The link in the 'resp' is true to my knowledge. I checked it by logging in > at diff times. Its coming the same every time and it is the link behind > 'Account Information' which comes on the front page after logging in. > > When I open output.html, Its giving me the same login form i.e same looks > as those of 'https://ebpp.airtelworld.com/pkmslogin.form' > > I tried with CookieJar() also. Same results. Can't say for sure. Are you getting back the session cookie? It might also make sense to try a more modern HTTP client library rather then stdlib. Krace's suggestion of requests is good as is Sageer's one of Mechanize. [...] -- ~noufal http://nibrahim.net.in Some bachelors want a meaningful overnight relationship. From lawgon at gmail.com Wed Dec 28 01:47:23 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Wed, 28 Dec 2011 06:17:23 +0530 Subject: [BangPypers] golf problem In-Reply-To: References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> <1324893940.2021.15.camel@xlquest.web> <87vcp3fvdx.fsf@sanitarium.localdomain> <1324965416.2021.18.camel@xlquest.web> Message-ID: <1325033243.2021.84.camel@xlquest.web> On Tue, 2011-12-27 at 18:19 +0530, Pratap Chakravarthy wrote: > I have posted at, http://pastebin.com/BG6X70Sv > I don't understand why or how it got stripped. mailing list policy -- regards Kenneth Gonsalves From lawgon at gmail.com Wed Dec 28 02:14:47 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Wed, 28 Dec 2011 06:44:47 +0530 Subject: [BangPypers] golf problem In-Reply-To: References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> <1324893940.2021.15.camel@xlquest.web> <87vcp3fvdx.fsf@sanitarium.localdomain> Message-ID: <1325034887.2021.87.camel@xlquest.web> On Mon, 2011-12-26 at 17:34 +0530, Pratap Chakravarthy wrote: > > I don't like special casing stuff and the 3 selections outside the> > "main" flow sticks out in my solution. > I guess that is right. Any logic that is outside the main flow breaks > the beauty > and create kludge. the old fashioned way: def peoria(holes): import random random.shuffle(holes) result = [] checklist = [] used = [] for hole in holes: if len(checklist) == 3: break if hole[1] not in checklist: result.append(hole) checklist.append(hole[1]) used.append(hole) available = set(holes) - set(used) result.extend(list(available)[:3]) return result -- regards Kenneth Gonsalves From lawgon at gmail.com Wed Dec 28 02:16:44 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Wed, 28 Dec 2011 06:46:44 +0530 Subject: [BangPypers] Coming soon page designer needed (was: BangPypers Digest, Vol 52, Issue 26) In-Reply-To: <8762h2i36c.fsf_-_@sanitarium.localdomain> References: <8762h2i36c.fsf_-_@sanitarium.localdomain> Message-ID: <1325035004.2021.88.camel@xlquest.web> On Tue, 2011-12-27 at 18:26 +0530, Noufal Ibrahim wrote: > P.S. This is the first email I've seen that's explictly asking for a > "beautiful" coder to get work done. :) I was wondering why he did not ask for her photo -- regards Kenneth Gonsalves From sriramnrn at gmail.com Wed Dec 28 04:22:32 2011 From: sriramnrn at gmail.com (Sriram Narayanan) Date: Wed, 28 Dec 2011 08:52:32 +0530 Subject: [BangPypers] Auto Login to Website and Capturing more details In-Reply-To: <87r4zqey1u.fsf@sanitarium.localdomain> References: <877h1olf2n.fsf@sanitarium.localdomain> <87r4zqey1u.fsf@sanitarium.localdomain> Message-ID: Alternatively, try Sahi. (http://sahi.co.in). There's an open source version available for download and use. -- Ram On 12/27/11, Noufal Ibrahim wrote: > > > Nikunj Badjatya writes: > > > [...] > >> The link in the 'resp' is true to my knowledge. I checked it by logging in >> at diff times. Its coming the same every time and it is the link behind >> 'Account Information' which comes on the front page after logging in. >> >> When I open output.html, Its giving me the same login form i.e same looks >> as those of 'https://ebpp.airtelworld.com/pkmslogin.form' >> >> I tried with CookieJar() also. Same results. > > Can't say for sure. Are you getting back the session cookie? It might > also make sense to try a more modern HTTP client library rather then > stdlib. Krace's suggestion of requests is good as is Sageer's one of > Mechanize. > > [...] > > > -- > ~noufal > http://nibrahim.net.in > > Some bachelors want a meaningful overnight relationship. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Sent from my mobile device ------------------------------------ Belenix: www.belenix.org Twitter: @sriramnrn From vsapre80 at gmail.com Wed Dec 28 11:32:28 2011 From: vsapre80 at gmail.com (Vishal) Date: Wed, 28 Dec 2011 16:02:28 +0530 Subject: [BangPypers] win32com.client.Dispatch In-Reply-To: References: Message-ID: On Tue, Dec 27, 2011 at 5:34 PM, Nitin Kumar wrote: > Hi All, > > Say I did > x=win32com.client.Dispatch("{6BF52A52-394A-11d3-B153-00C04F79FAA6}") > > where the clsid used is for window media palyer. > Now if i do: > >>> dir(x) > ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', > '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', > '__getattr__', '__getitem__', '__init__', '__int__', '__len__', > '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', > '__setitem__', '__str__', '_builtMethods_', '_enum_', > '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', > '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', > '_print_details_', '_proc_', '_unicode_to_string_', '_username_', > '_wrap_dispatch_'] > > It won't show any function related to this specific dll. This happens with > any COMObject. > So, is there any way to find out what all functions can be used with this > object. (or any doc to give more depth) > > -- > Nitin K > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > Hello, >From what I remember having worked on COM/DCOM a few years back, the DLL needs to have functions defined using a certain return type for all the functions that are exposed. Then the win32com module can query the DLL to see what functions are present. Please note that even if they cannot be queried, they can certainly be used, if you know their signature. Also look at how to launch an Automation Application from OLE Automation from Python examples on the web. There are slight differences in how you launch, and that may be the reason. PythonWin IDE that comes with the PyWin32 libraries has a OLE/COM Object viewer that should be able to show you all the functions that are exposed by a registered DLL. -- Thanks and best regards, Vishal Sapre From lawgon at gmail.com Wed Dec 28 13:00:45 2011 From: lawgon at gmail.com (Kenneth Gonsalves) Date: Wed, 28 Dec 2011 17:30:45 +0530 Subject: [BangPypers] golf problem In-Reply-To: <1325034887.2021.87.camel@xlquest.web> References: <1324797734.10514.26.camel@xlquest.web> <4EF6E094.3060908@lonetwin.net> <1324893940.2021.15.camel@xlquest.web> <87vcp3fvdx.fsf@sanitarium.localdomain> <1325034887.2021.87.camel@xlquest.web> Message-ID: <1325073645.2021.91.camel@xlquest.web> On Wed, 2011-12-28 at 06:44 +0530, Kenneth Gonsalves wrote: > def peoria(holes): > import random > random.shuffle(holes) > result = [] > checklist = [] > used = [] > for hole in holes: > if len(checklist) == 3: > break > if hole[1] not in checklist: > result.append(hole) > checklist.append(hole[1]) > used.append(hole) > available = set(holes) - set(used) > result.extend(list(available)[:3]) > return result and the my final version: def peoria(holes): random.shuffle(holes) result = [] checklist = [] for hole in holes: if len(checklist) == 3: break if hole[1] not in checklist: result.append(hole) checklist.append(hole[1]) available = [x for x in holes if x not in result] result.extend(available[:3]) return result -- regards Kenneth Gonsalves From nitin.nitp at gmail.com Thu Dec 29 08:49:38 2011 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Thu, 29 Dec 2011 13:19:38 +0530 Subject: [BangPypers] win32com.client.Dispatch In-Reply-To: References: Message-ID: Thanks Visal/Sujit/Noufal, All of your reply was of great help. Specially COM Raider and makepy.py (from PyWin32 libraries) Thanks again Nitin K On Wed, Dec 28, 2011 at 4:02 PM, Vishal wrote: > On Tue, Dec 27, 2011 at 5:34 PM, Nitin Kumar wrote: > > > Hi All, > > > > Say I did > > x=win32com.client.Dispatch("{6BF52A52-394A-11d3-B153-00C04F79FAA6}") > > > > where the clsid used is for window media palyer. > > Now if i do: > > >>> dir(x) > > ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', > '_Release_', > > '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', > > '__getattr__', '__getitem__', '__init__', '__int__', '__len__', > > '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', > > '__setitem__', '__str__', '_builtMethods_', '_enum_', > > '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', > > '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', > '_olerepr_', > > '_print_details_', '_proc_', '_unicode_to_string_', '_username_', > > '_wrap_dispatch_'] > > > > It won't show any function related to this specific dll. This happens > with > > any COMObject. > > So, is there any way to find out what all functions can be used with this > > object. (or any doc to give more depth) > > > > -- > > Nitin K > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > Hello, > > >From what I remember having worked on COM/DCOM a few years back, the DLL > needs to have functions defined using a certain return type for all the > functions that are exposed. Then the win32com module can query the DLL to > see what functions are present. Please note that even if they cannot be > queried, they can certainly be used, if you know their signature. > > Also look at how to launch an Automation Application from OLE Automation > from Python examples on the web. There are slight differences in how you > launch, and that may be the reason. > > PythonWin IDE that comes with the PyWin32 libraries has a OLE/COM Object > viewer that should be able to show you all the functions that are exposed > by a registered DLL. > > -- > Thanks and best regards, > Vishal Sapre > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Nitin K From Nikunj.Badjatya at emc.com Thu Dec 29 12:57:19 2011 From: Nikunj.Badjatya at emc.com (Nikunj.Badjatya at emc.com) Date: Thu, 29 Dec 2011 06:57:19 -0500 Subject: [BangPypers] Background ping - check for server availability Message-ID: <599CEBACD49B4144A61212D837EE3C0F16F47E6AC6@MX34A.corp.emc.com> Oops.. take esxname = ip From: Badjatya, Nikunj Sent: Thursday, December 29, 2011 5:24 PM To: Bangalore Python Users Group - India Subject: Background ping - check for server availability Hi, I want to check the availability of the server ( in the sense ) by continuously pinging it in intervals of 30 seconds. I am using Python2.7 on windows platform. I wrote the following snippet. It works fine but it opens a windows cmd prompt everytime it is reaching subprocess.call() {{{ import subprocess import time def checkserveravail(ip): while True: pingret = subprocess.call('ping {0} -n 1'.format(esxname)) if pingret == 0: time.sleep(30) continue else: print("The server {0} is not reacheable. Please check network connectivity".format(ip)) checkserveravail('xx.xx.xx.xx') }}} This snippet will be a part of larger program. Where a thread will be doing this job of checking server recheability. I do not want that cmd prompt windows to open everytime and just want this job to happen in background. I also do not want to import any external module like ping, which will unnecessarily increase the dependencies in my programs. Any clues? Thanks, Nikunj 7 Switch off as you go | qRecycle always | P Save Paper - Save Trees | Go Green From Nikunj.Badjatya at emc.com Thu Dec 29 12:53:54 2011 From: Nikunj.Badjatya at emc.com (Nikunj.Badjatya at emc.com) Date: Thu, 29 Dec 2011 06:53:54 -0500 Subject: [BangPypers] Background ping - check for server availability Message-ID: <599CEBACD49B4144A61212D837EE3C0F16F47E6AC5@MX34A.corp.emc.com> Hi, I want to check the availability of the server ( in the sense ) by continuously pinging it in intervals of 30 seconds. I am using Python2.7 on windows platform. I wrote the following snippet. It works fine but it opens a windows cmd prompt everytime it is reaching subprocess.call() {{{ import subprocess import time def checkserveravail(ip): while True: pingret = subprocess.call('ping {0} -n 1'.format(esxname)) if pingret == 0: time.sleep(30) continue else: print("The server {0} is not reacheable. Please check network connectivity".format(ip)) checkserveravail('xx.xx.xx.xx') }}} This snippet will be a part of larger program. Where a thread will be doing this job of checking server recheability. I do not want that cmd prompt windows to open everytime and just want this job to happen in background. I also do not want to import any external module like ping, which will unnecessarily increase the dependencies in my programs. Any clues? Thanks, Nikunj 7 Switch off as you go | qRecycle always | P Save Paper - Save Trees | Go Green From kracethekingmaker at gmail.com Thu Dec 29 19:44:54 2011 From: kracethekingmaker at gmail.com (kracekumar ramaraju) Date: Fri, 30 Dec 2011 00:14:54 +0530 Subject: [BangPypers] Background ping - check for server availability In-Reply-To: <599CEBACD49B4144A61212D837EE3C0F16F47E6AC5@MX34A.corp.emc.com> References: <599CEBACD49B4144A61212D837EE3C0F16F47E6AC5@MX34A.corp.emc.com> Message-ID: Hi Inline replies. On Thu, Dec 29, 2011 at 5:23 PM, wrote: > Hi, > I want to check the availability of the server ( in the sense ) by > continuously pinging it in intervals of 30 seconds. > I am using Python2.7 on windows platform. > I wrote the following snippet. It works fine but it opens a windows cmd > prompt everytime it is reaching subprocess.call() > > {{{ > import subprocess > import time > > def checkserveravail(ip): > while True: > pingret = subprocess.call('ping {0} -n 1'.format(esxname)) > if pingret == 0: > time.sleep(30) > continue > else: > print("The server {0} is not reacheable. Please check network > connectivity".format(ip)) > > > checkserveravail('xx.xx.xx.xx') > > }}} > > This snippet will be a part of larger program. Where a thread will be > doing this job of checking server recheability. > > I do not want that cmd prompt windows to open everytime and just want this > job to happen in background. > I also do not want to import any external module like ping, which will > unnecessarily increase the dependencies in my programs. > > Any clues? > > You can try this, I have tried this GNU/Linux. In[8]: import commands In [9]: commands.getstatusoutput("ping -c 1 www.google.com") Out[9]: (0, 'PING www.l.google.com (74.125.236.146) 56(84) bytes of data.\n64 bytes from bom03s02-in-f18.1e100.net (74.125.236.146): icmp_req=1 ttl=56 time=737 ms\n\n--- www.l.google.com ping statistics ---\n1 packets transmitted, 1 received, 0% packet loss, time 0ms\nrtt min/avg/max/mdev = 737.818/737.818/737.818/0.000 ms') replace google.com with IP. In case your intension is to check whether website hosted in the IP is active, you can use requests. requests needs to be installed in your machine. www.python-requests.org In [10]: import requests In [11]: r = requests.get("http://www.google.com") In [12]: r.status_code Out[12]: 200 Note: If "http" is ignoree in requests.get, an error is raised. Thanks, > Nikunj > > 7 Switch off as you go | qRecycle always | P Save Paper - Save Trees | > Go Green > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- * Thanks & Regards "Talk is cheap, show me the code" -- Linus Torvalds kracekumar www.kracekumar.com * From nikunjbadjatya at gmail.com Thu Dec 29 20:32:01 2011 From: nikunjbadjatya at gmail.com (Nikunj Badjatya) Date: Fri, 30 Dec 2011 01:02:01 +0530 Subject: [BangPypers] Background ping - check for server availability In-Reply-To: References: <599CEBACD49B4144A61212D837EE3C0F16F47E6AC5@MX34A.corp.emc.com> Message-ID: Hi, I think the commands.getstatusoutput() is only for unix systems. When I run on windows I get this error: {{{ >>> ret = commands.getstatusoutput('ping 192.168.1.1') >>> ret (1, "'{' is not recognized as an internal or external command,\noperable program or batch file.") }}} I then tried once again with subprocess module: {{{ >>> pipe = subprocess.Popen('ping 192.168.1.1', shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) >>> sts = pipe.wait() >>> sts 0 }}} and this seems to work exactly as I wanted and it does not open a windows cmd prompt window. Previously I was using 'shell=False' . After little more reading, I understood the difference and got the correct way. Thanks, Nikunj -- *7*Switch off as you go |*q*Recycle always | P Save Paper - Save Trees | Go Green On Fri, Dec 30, 2011 at 12:14 AM, kracekumar ramaraju < kracethekingmaker at gmail.com> wrote: > Hi > > Inline replies. > > On Thu, Dec 29, 2011 at 5:23 PM, wrote: > > > Hi, > > I want to check the availability of the server ( in the sense ) by > > continuously pinging it in intervals of 30 seconds. > > I am using Python2.7 on windows platform. > > I wrote the following snippet. It works fine but it opens a windows cmd > > prompt everytime it is reaching subprocess.call() > > > > {{{ > > import subprocess > > import time > > > > def checkserveravail(ip): > > while True: > > pingret = subprocess.call('ping {0} -n 1'.format(esxname)) > > if pingret == 0: > > time.sleep(30) > > continue > > else: > > print("The server {0} is not reacheable. Please check network > > connectivity".format(ip)) > > > > > > checkserveravail('xx.xx.xx.xx') > > > > }}} > > > > This snippet will be a part of larger program. Where a thread will be > > doing this job of checking server recheability. > > > > I do not want that cmd prompt windows to open everytime and just want > this > > job to happen in background. > > I also do not want to import any external module like ping, which will > > unnecessarily increase the dependencies in my programs. > > > > Any clues? > > > > > You can try this, I have tried this GNU/Linux. > > In[8]: import commands > > In [9]: commands.getstatusoutput("ping -c 1 www.google.com") > Out[9]: > (0, > 'PING www.l.google.com (74.125.236.146) 56(84) bytes of data.\n64 bytes > from bom03s02-in-f18.1e100.net (74.125.236.146): icmp_req=1 ttl=56 > time=737 > ms\n\n--- www.l.google.com ping statistics ---\n1 packets transmitted, 1 > received, 0% packet loss, time 0ms\nrtt min/avg/max/mdev = > 737.818/737.818/737.818/0.000 ms') > > replace google.com with IP. > > In case your intension is to check whether website hosted in the IP is > active, you can use requests. requests needs to be installed in your > machine. > > www.python-requests.org > > In [10]: import requests > > In [11]: r = requests.get("http://www.google.com") > > In [12]: r.status_code > Out[12]: 200 > > Note: If "http" is ignoree in requests.get, an error is raised. > > > Thanks, > > Nikunj > > > > 7 Switch off as you go | qRecycle always | P Save Paper - Save Trees > | > > Go Green > > > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > * > Thanks & Regards > > "Talk is cheap, show me the code" -- Linus Torvalds > kracekumar > www.kracekumar.com > * > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > http://mail.python.org/mailman/listinfo/bangpypers > From saager.mhatre at gmail.com Fri Dec 30 10:13:51 2011 From: saager.mhatre at gmail.com (Saager Mhatre) Date: Fri, 30 Dec 2011 14:43:51 +0530 Subject: [BangPypers] Background ping - check for server availability In-Reply-To: References: <599CEBACD49B4144A61212D837EE3C0F16F47E6AC5@MX34A.corp.emc.com> Message-ID: On Fri, Dec 30, 2011 at 1:02 AM, Nikunj Badjatya wrote: > Hi, > > I think the commands.getstatusoutput() is only for unix systems. > When I run on windows I get this error: > > {{{ > >>> ret = commands.getstatusoutput('ping 192.168.1.1') > >>> ret > (1, "'{' is not recognized as an internal or external command,\noperable > program or batch file.") > }}} on windows, try `commads.getstatusoutput('cmd ping 192.168.1.1')` - d