[BangPypers] Question on GUI
Howdy All, I have never worked on developing GUIs before. Need some suggestions on how to proceed with one. I have a program which takes bunch of inputs from the user. ( 15 ). Currently I use an well structured xml file where user puts his necessary details, then this xml file is passed to the program where it is parsed, validated and then actual things proceed. ( Ex. $ program.py -f input.xml ) I am looking to have basic GUI for taking inputs from the user. Much like form filling where 1. There will be different input boxes for different input field. User can type his choice of inputs in there. 2. All previous inputs should also come in a drop down of respective input field. 3. User should also be able to save all 15 inputs given by him by some 'name' so that next time by just clicking/selecting that 'name' all 15 field should get populated. 4. The GUI can then take these inputs and start the program.py. 5. I would also want to have a progressbar. Any ideas.? Thanks, Nikunj -- *7*Switch off as you go |*q*Recycle always | P Save Paper - Save Trees | Go Green ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] checking return status of 'ping' in windows
Hi All, I am using the following snippet to check the availability of an IP address. If that IP addr is found free than it can be used later on for further operations. Python ver 3.2 Windows OS {{{ pingret = subprocess.Popen('ping {0}'.format(IPaddr), shell=True,universal_newlines=True, \ stdout=subprocess.PIPE, stderr=subprocess.STDOUT) status = pingret.wait() if status == 0: print(WARN The IP given in the input is not free) . . }}} Normal ping operation on windows cmd prompt can give 3 outputs. 1) destination host unreachable 2) request timed out 3) Reply from 192.168.1.1: bytes=32 time=3ms TTL=64 Now, I was expecting the status in above snippet to hold '0' only in case of no. 3) But even when we have case 1), 'status' is holding '0'. i.e. The exit status of ping is 0, even when destination host is unreachable.! How do I make my snippet to work as desired. i.e even if destination host is unreachable, 'status' should hold '1' and hold '0' only when it gets reply from that ip address.?? Thanks, Nikunj -- *7*Switch off as you go |*q*Recycle always | P Save Paper - Save Trees | Go Green ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] checking return status of 'ping' in windows
Telnet service is not running and not in my hands to start it. Its a Virtual Machine basically. On Sun, Jan 22, 2012 at 12:21 AM, Noufal Ibrahim nou...@nibrahim.net.inwrote: Nikunj Badjatya nikunjbadja...@gmail.com writes: [...] Now, I was expecting the status in above snippet to hold '0' only in case of no. 3) But even when we have case 1), 'status' is holding '0'. i.e. The exit status of ping is 0, even when destination host is unreachable.! How do I make my snippet to work as desired. i.e even if destination host is unreachable, 'status' should hold '1' and hold '0' only when it gets reply from that ip address.?? You could grep the output of ping to check what happened but this is a clumsy way of doing this. Isn't there some service running on the remote machine that you can telnet to to ascertain whether it is up or not rather than spawning ping an checking its output status? [...] -- ~noufal http://nibrahim.net.in All generalisations are dangerous, including this one. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Background ping - check for server availability
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 kracethekingma...@gmail.com wrote: Hi Inline replies. On Thu, Dec 29, 2011 at 5:23 PM, nikunj.badja...@emc.com 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@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@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Auto Login to Website and Capturing more details
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 saager.mha...@gmail.comwrote: On Thu, Dec 22, 2011 at 10:27 PM, Noufal Ibrahim nou...@gmail.com 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 http://pypi.python.org/pypi/mechanizesimplify all this? - d ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] continue in try..except
Can someone throw some light on this please. On Fri, Nov 18, 2011 at 7:23 PM, nikunj.badja...@emc.com wrote: Hi , Please look at the below code snippet: {{{ if __name__ == __main__: try: main() except KeyboardInterrupt: print(\nKeyboard interrupt from the user !!) ret = input(Want to abort the installation ?[y/n]: ) while True: if ret == y: sys.exit(0) elif ret == n: ## Want to continue the main() where it left of. else: ret = input(Please enter either y/n : ) continue }}} In the elif block. I want to have a provision wherein main() would continue its execution where it left off. How can this be done.? Thanks Nikunj ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] How to create HTTPS Proxy server
Deepak, Can you give some info. * Like which platform ( linux, windows ) you creating your proxy server.? * Which 3rd party tools you using .? Like apache etc. Not sure about Python based tools but I have done one similar configuration few months back. Apache server may help you. Just google for Apache forward proxy. You just need to configure httpd.conf file. On Fri, Oct 7, 2011 at 6:31 PM, deepak gupta dg288_m...@yahoo.co.in wrote: Hi All, Do any one know , how to create reverse proxy server over HTTPS? We want to create one HTTPS proxy server: 1. Proxy server (192.168.1.1) : HTTPS port (8000) binding on this server and user will access this server and browse some url's.for ex https://192.168.1.1:8000/xyz 2. This (proxy) server 192.168.1.1 will talk to another web server actual backend server (192.168.1.2: 8000) over HTTP/HTTPS . HTTPS proxy server will forward the request to the backend server and get back the response and then return to client browser. We have created but it is hanging and sometime not returning full data.If anyone knows any stable proxy server over HTTPS then please let me know. Thanks, Deepak ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] (no subject)
+1 :) On Mon, Sep 12, 2011 at 7:34 PM, AKARSH SANGHI akarsh.san...@gmail.comwrote: Hey, here's a great video with Python in it. http://youtu.be/1lBeungEnx4 Although it's also about matlab. -- Akarsh Sanghi Jaypee Institute of Information Technology University Undergraduate Student Class of 2013 Mob: (+91)-9818489945 Email: akarsh.san...@gmail.com ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [commercial] python/django training
hi I have 5 years exp using Python/Django i want to give free training to all please contact Dear Srinivas, Please let us know the place, venue and timings. Really appreciate your efforts. Although most of us wouldnt mind paying a nominal fee. ! Nikunj On Sun, May 15, 2011 at 5:17 PM, vikas ruhil vikasruhi...@gmail.com wrote: @Ramdas why not? a the average freebie seeker will never see the value of your efforts? nothing like that? someone really interested in learning stuff surely give value to instructor! don't forget power of open-source , django is also open-source if some one patent this one then really django is that much popular ? so please contribute !! money matter's but sometime attitude ,enthusiasm matter .it lead to teach INDIA , i really appreciate India moves forword then only India can compete USA in technology ??? so need more guys do it ... On Sun, May 15, 2011 at 4:57 PM, Ramdas S ram...@gmail.com wrote: On Sun, May 15, 2011 at 3:00 PM, srinivasa rao srinivasaene...@gmail.com wrote: hi I have 5 years exp using Python/Django i want to give free training to all please contact Srinivas, I appreciate your enthusiasm. But a word of caution. Moment you start giving away a service free, it's value go down, and the average freebie seeker will never see the value of your efforts. Charge something even if it's Rs 100. It's not the same as dropping your code for others to learn, cntribute and use, which is how the free and open source community work. The value of your source code go up manyfold, as more people use, fix bugs and create a better platform. If you want to offer training free, do it for a community that deserves. Go to engineering colleges or schools, and organize a workshop or two, create a few pythonistas there. Ramdas ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] UnicodeDecodeError: 'utf8' codec can't decode byte xxx
Hi All, I am working on a self project for grabbing certain URL's from the web. Do some processing and store the final contents in text/pdf file. I am also using html2text ( https://github.com/aaronsw/html2text/archives/master ) for converting the fetched page into text format. As a first step I tried with fetching and converting to text using following code. Code : {{{ #!/bin/python import os import urllib fetch = urllib.urlopen(some-web-link.htm) mainfile = open ('main.html', 'w' ) mainfile.write(fetch.read()) os.system('python2.6 html2text.py main.html main.txt') }}} It flags an error: {{{ Traceback (most recent call last): File html2text.py, line 447, in module data = open(arg, 'r').read().decode(encoding) File /usr/lib/python2.6/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x88 in position 11366: invalid start byte }}} I also tried with {{{ + import codecs ... ... - mainfile = open ('main.html', 'w' ) +mainfile = codecs.open('xyz.htm', 'w', None, 'ignore') ... ... }}} Result is coming the same. Please tell as to what can be done to avoid this error.? Thanks, Nikunj Bangalore, India ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] UnicodeDecodeError: 'utf8' codec can't decode byte xxx
Thanks for the quick reply.. I hve never touched Django before. I tried as: {{{ #!/bin/python import os import urllib + from django.utils.encoding import smart_str fetch = urllib.urlopen(some-web-link.htm) mainfile = open ('main.html', 'w' ) + myunistr = smart_str(fetch) print myunistr mainfile.write(myunistr) os.system('python2.6 html2text.py main.html main.txt') }}} The execution went fine without any issues. But when I open the main.html. I was expecting it to havee full contents of the page . But it has only , {{{ addinfourl at 148983116 whose fp = socket._fileobject object at 0x8deabac }}} Please let me know if I am missing something. Thanks, Nikunj On Sun, Apr 17, 2011 at 8:11 PM, JAGANADH G jagana...@gmail.com wrote: On Sun, Apr 17, 2011 at 8:01 PM, Nikunj Badjatya nikunjbadja...@gmail.comwrote: Hi All, I am working on a self project for grabbing certain URL's from the web. Do some processing and store the final contents in text/pdf file. I am also using html2text ( https://github.com/aaronsw/html2text/archives/master ) for converting the fetched page into text format. As a first step I tried with fetching and converting to text using following code. Code : {{{ #!/bin/python import os import urllib fetch = urllib.urlopen(some-web-link.htm) mainfile = open ('main.html', 'w' ) mainfile.write(fetch.read()) os.system('python2.6 html2text.py main.html main.txt') }}} It flags an error: {{{ Traceback (most recent call last): File html2text.py, line 447, in module data = open(arg, 'r').read().decode(encoding) File /usr/lib/python2.6/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x88 in position 11366: invalid start byte }}} I also tried with {{{ + import codecs ... ... - mainfile = open ('main.html', 'w' ) +mainfile = codecs.open('xyz.htm', 'w', None, 'ignore') ... ... }}} Result is coming the same. Please tell as to what can be done to avoid this error.? Try this from django.utils.encoding import smart_str myunistr = smart_str(YOUR_STRING) This will solve the issue -- ** JAGANADH G http://jaganadhg.freeflux.net/blog *ILUGCBE* http://ilugcbe.techstud.org ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] UnicodeDecodeError: 'utf8' codec can't decode byte xxx
Dear Jaganadh, I have tried with separate individual execution as {{{ $ python html2text.py index1.htm Traceback (most recent call last): File ../aaronsw-html2text-d9bf7d6/html2text.py, line 488, in module data = data.decode(encoding) File /usr/lib/python2.6/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x88 in position 11366: invalid start byte }}} Where index1.htm is the fetched page from http://www.hindu.com/nic/kye/index1.htm; while with index2.htm , fetched from http://www.hindu.com/nic/kye/index2.htm the command works fine..!! I also tried with importing as, from html2text import * and calling the function accordingly. Same results.!! Thanks, Nikunj On Sun, Apr 17, 2011 at 9:21 PM, JAGANADH G jagana...@gmail.com wrote: On Sun, Apr 17, 2011 at 9:13 PM, Nikunj Badjatya nikunjbadja...@gmail.com wrote: Tried with the change. {{{ ... ... - myunistr = smart_str(fetch) + myunistr = smart_str(fetch.read()) ... ... }}} Output: {{{ Traceback (most recent call last): File html2text.py, line 447, in module data = open(arg, 'r').read().decode(encoding) File /usr/lib/python2.6/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x88 in position 11366: invalid start byte }}} Same error as before. !! ?? I think the error is coming from this line os.system('python2.6 html2text.py main.html main.txt') Insted of calling os.system try to import concerned function from html2text.py in the program -- ** JAGANADH G http://jaganadhg.freeflux.net/blog *ILUGCBE* http://ilugcbe.techstud.org ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] UnicodeDecodeError: 'utf8' codec can't decode byte xxx
Hi, With stripogram Its working fine. Thanks a lot. :) !! But couldnt understand the reason behind the previous html2text malfunction for that particular (index1.htm) link.??! On Sun, Apr 17, 2011 at 10:28 PM, JAGANADH G jagana...@gmail.com wrote: Hi Do the following things install the python librarry stripogram (easy_install stripogram) Then insted of html2text import do from stripogram import html2text Change mainfile.write(fetch.read()) -- mainfile.write(html2text(fetch.read())) comment the line os.system('python2.6 html2text.py main.html main.txt') Also you can use the *re* module in Python to find the index , so that you can avoid using popen and grep too -- ** JAGANADH G http://jaganadhg.freeflux.net/blog *ILUGCBE* http://ilugcbe.techstud.org ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] UnicodeDecodeError: 'utf8' codec can't decode byte xxx
On Sun, Apr 17, 2011 at 11:17 PM, JAGANADH G jagana...@gmail.com wrote: On Sun, Apr 17, 2011 at 11:13 PM, Nikunj Badjatya nikunjbadja...@gmail.com wrote: Hi, With stripogram Its working fine. Thanks a lot. :) !! But couldnt understand the reason behind the previous html2text malfunction for that particular (index1.htm) link.??! beacuse html2text encounters a problem with utf-8 decoding . nothing much So theres no other alternative to use besides utf-8 encoding with older html2text.? On looking at the source code , at line no. 444. They have used encoding=utf-8. Is this can be replaced by something else.? Also there is a lil problem with this new html2text. it does not provide the href links which the older html2text was providing. !! Its a complete text now. Anyways I will figure out the solution for it.. ! Thanks -- ** JAGANADH G http://jaganadhg.freeflux.net/blog *ILUGCBE* http://ilugcbe.techstud.org ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Program_to_catch_changes_in_webpage
Hi All, I am actually using a web interface for outlook mails. Pointing the link to my browser opens a page which shows me all my mails. I had to refresh it to check for a new mail. Many a times I was very late to send a reply because of it. So a thought to make a script which will automatically refresh that web page, and tells to user for any new mails by popping a dialog or making a sound. * It should periodically check for any changes in that webpage . * If their is any, then notification should be sent to user. ( some dialog pop up, or some sound. ) Any idea as to how to proceed on this. ? OS - Linux ( CentOS 5.4) Browser - Firefox, Opera Thanks, Nikunj Badjatya Bangalore, India ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Tutor] Program_to_catch_changes_in_webpage
Hi, Is it the standard Outlook Web Access(OWA) tool that comes with MS Exchange? Yes. Are you trying to write a script that talks to the web browser to refresh the page? Or are you looking to monitor the server? Yes, Talking to the web browser seems to be easiest way without notifying admin. Nikunj Badjatya BTech On Thu, May 27, 2010 at 1:20 PM, Alan Gauld alan.ga...@btinternet.comwrote: nikunj badjatya nikunjbadja...@gmail.com I am actually using a web interface for outlook mails. * It should periodically check for any changes in that webpage . * If their is any, then notification should be sent to user. ( some dialog pop up, or some sound. ) Is it the standard Outlook Web Access(OWA) tool that comes with MS Exchange? If so you can adjust your settings to have both an audible and visual notification of new mail. OS - Linux ( CentOS 5.4) Browser - Firefox, Opera Although that might only work on IE under Windows... I've never tried on Linux although the basic GUI works OK there. So a thought to make a script which will automatically refresh that web page, and tells to user for any new mails by popping a dialog or making a sound. Are you trying to write a script that talks to the web browser to refresh the page? Or are you looking to monitor the server? I suspect the second option is easier, but could make you unpopular with the admin team! HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - tu...@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] [Tutor] Error :Attempt to overwrite cell while using xlwt to create excel sheets
Hi, Many thanks to all.. I tried cell_overwrite=True and its working fine..!! On Wed, Feb 10, 2010 at 6:13 PM, Kent Johnson ken...@tds.net wrote: On Wed, Feb 10, 2010 at 6:47 AM, nikunj badjatya nikunjbadja...@gmail.com wrote: I commented out the raise Exception statement in Row.py library module. Here's the (line no. 150 ) of Row.py which i have edited: def insert_cell(self, col_index, cell_obj): if col_index in self.__cells: if not self.__parent._cell_overwrite_ok: msg = Attempt to overwrite cell: sheetname=%r rowx=%d colx=%d \ % (self.__parent.name, self.__idx, col_index) #raise Exception(msg) #*commented to avoid error. prev_cell_obj = self.__cells[col_index] sst_idx = getattr(prev_cell_obj, 'sst_idx', None) if sst_idx is not None: self.__parent_wb.del_str(sst_idx) self.__cells[col_index] = cell_obj The excel sheet creation code now works fine. My question is, Instead of manually goin to /usr/lib/.../row.py and commenting out the line, Can this be done through few lines of code in my program itself. ?? Looking at the code above, you can see that the exception is raised only if self.__parent._cell_overwrite_ok is False. So there is an option to allow overwriting. From the error message it appears that self.__parent is a Worksheet. Looking at the source code for Worksheet.py, the __init__() method does have an optional cell_overwrite_ok= parameter. This parameter is also available in Workbook.add_sheet(). So if you pass cell_overwrite=True to add_sheet() you should be OK. Kent ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Error :Attempt to overwrite cell while using xlwt to create excel sheets
Hi, I am using xlwt 0.7.2 and Python 2.6. I come across a situation wherein one of the rows of the excel sheet created was being overwritten. And it was flagging the following error. File /usr/local/lib/python2.6/site-packages/xlwt/Row.py, line 150, in insert_cell raise Exception(msg) Exception: Attempt to overwrite cell *Action Taken:* I commented out the raise Exception statement in Row.py library module. Here's the (line no. 150 ) of Row.py which i have edited: def insert_cell(self, col_index, cell_obj): if col_index in self.__cells: if not self.__parent._cell_overwrite_ok: msg = Attempt to overwrite cell: sheetname=%r rowx=%d colx=%d \ % (self.__parent.name, self.__idx, col_index) *#raise Exception(msg) #*commented to avoid error. * prev_cell_obj = self.__cells[col_index] sst_idx = getattr(prev_cell_obj, 'sst_idx', None) if sst_idx is not None: self.__parent_wb.del_str(sst_idx) self.__cells[col_index] = cell_obj The excel sheet creation code now works fine. *My question is, Instead of manually goin to /usr/lib/.../row.py and commenting out the line, Can this be done through few lines of code in my program itself. ??* As in if I use my program on different system, then again I have to comment out that line in row.py..!! Any suggestions?? Thanks, Nikunj Bangalore, India ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
[BangPypers] Future of Python Programmers
Dear all BangPyPers, I couldnt attend the January's user group meeting becoz of unforseen circumstances. I have one important question to ask to all of you, I am a fresher, recently completed my graduation, had started working on python 2 months back..!! and I just fell in love with the language. I want to learn more about it. The only concern is there arent enough companies which work on Python. ( correct if I am wrong?? ) and also kindly tell me the core application areas of the language, ( Is there any where Python is dominating compared to other languages? ) I followed up a link ( http://www.dmh2000.com/cjpr/ ) which nicely illustrates difference between many languages. Is there any chance where the development of Python will make it as fast as C++ or JAVA, (or it is at its optimum level? ) . P.S. I have recently joined the group, dont know if similar discussions held before. Sincerely, Nikunj Badjatya ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] Interesting Read
Hi, Interesting Read indeed..! Thanks !! -- Nikunj Badjatya BTech ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] January user group meeting
+1 Nikunj Btech, Sony India Software Centre, Bangalore ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers