Urllib2 urlopen and read - difference

2010-04-15 Thread koranthala
Hi, Suppose I am doing the following: req = urllib2.urlopen('http://www.python.org') data = req.read() When is the actual data received? is it done by the first line? or is it done only when req.read() is used? My understanding is that when urlopen is done itself, we would have received al

Adding a cookie

2010-01-17 Thread koranthala
Hi, I am creating a webscraper for a specific web site for an application. Now, that website has a specific cookie which needs to be set in the request. Otherwise, the website is redirected. I have been trying for the last 6 hours to add a cookie to the HTTP request, but to no avail.

Re: Python py2exe - memory load error

2009-11-30 Thread koranthala
On Nov 30, 10:10 am, koranthala wrote: > This is cross post from stackoverflow - I couldnt get the solution > there. Hopefully, nobody would mind. > > I am creating a medium level application in Python. Everything works > well now, and I am trying to make this a windows executabl

pywintypes error

2009-11-30 Thread koranthala
Hi, When I try to use Django with Apache and mod_python, I am facing an issue. Since this is a very usual configuration, I hope this issue is already solved. My web sites fail with the following error : "C:\\Python24\\Lib\\site-packages\\win32\\lib\\pywintypes.py", line 124, in?\n __import_p

Python py2exe - memory load error

2009-11-29 Thread koranthala
This is cross post from stackoverflow - I couldnt get the solution there. Hopefully, nobody would mind. I am creating a medium level application in Python. Everything works well now, and I am trying to make this a windows executable with py2exe. The executable is created fine, but when I try to ru

python os.path.exists failure

2009-10-31 Thread koranthala
Hi all, My code is as follows: path = r'C:/"Program Files"/testfolder/2.3/test.txt' if os.path.lexists(path): print 'Path Exists' else: print 'No file found in path - %s' %path print Popen(path, stdout=PIPE, shell=True).stdout.read() The output comes as No file found in path - C:/"Prog

Re: sqlite question

2009-10-17 Thread koranthala
On Oct 17, 12:18 pm, Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Dennis Lee Bieber wrote: > >    I suspect, besides building an sqlite3.dll (if Windows), you might > > have to modify the pysqlite DB-API adapter to support whatever new > > arguments have been added to v

sqlite question

2009-10-16 Thread koranthala
Hi, I use sqlalchemy to use a sqlite db in my program. The program is working perfectly as of now. But now, a new requirement has come that the db has to be encrypted. I found two options while searching internet - SQLite Encryption Extension and Sqlite-Crypt. Now, buying the license is not a

Re: How to find number of line that is currently executing?

2009-10-10 Thread koranthala
On Oct 10, 8:54 am, Chris Rebert wrote: > On Fri, Oct 9, 2009 at 8:46 PM, Dr. Phillip M. Feldman > > wrote: > > > I would like to put a statement on line N of my program that prints the line > > number that is currently executing. This may sound fairly trivial, but I > > don't want to hard code t

Re: Global array in python

2009-09-29 Thread koranthala
On Sep 29, 5:48 am, Rudolf wrote: > How can i declare a global array in python? As others have mentioned, you do not have concept of declaration. But if you are looking for creating a global variable, it is like any other language. Declare the same in a module, outside any procedures or classes.

Re: Screencapture of a video

2009-09-24 Thread koranthala
On Sep 24, 12:38 pm, koranthala wrote: > Hi, >     I was trying to capture the video which I was viewing using > Imagegrab module in PIL (windows). But, I found that the video was not > captured at all. A quick googling tells me that it is because the > windows does not have access

Screencapture of a video

2009-09-24 Thread koranthala
Hi, I was trying to capture the video which I was viewing using Imagegrab module in PIL (windows). But, I found that the video was not captured at all. A quick googling tells me that it is because the windows does not have access to the viewing area. Is there any way I can capture the video?

Re: easy question, how to double a variable

2009-09-22 Thread koranthala
On Sep 21, 1:27 am, daggerdvm wrote: >  Write the definition of a function  twice , that receives an  int > parameter and returns an  int that is twice the value of the > parameter. > > how can i do this Please note that most mails here are humorous - as should be expected for a language named af

Re: How to print without spaces?

2009-09-18 Thread koranthala
On Sep 18, 9:49 pm, "Andreas Tawn" wrote: > > Hi, > > > I don't want to print the space between 'a' and 'b'. Could somebody > > let me know how to do it? > > > Regards, > > Peng > > > $ python > > Python 2.5.2 (r252:60911, May 21 2008, 10:08:24) > > [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux

Re: HTTPS on Twisted

2009-09-07 Thread koranthala
On Sep 6, 7:53 pm, koranthala wrote: > Hi, >    For a financial application,  I am creating a python tool which > uses HTTPS to transfer the data from client to server. Now, everything > works perfectly, since the SSL support comes free with Twisted. >    I have one problem though

HTTPS on Twisted

2009-09-06 Thread koranthala
Hi, For a financial application, I am creating a python tool which uses HTTPS to transfer the data from client to server. Now, everything works perfectly, since the SSL support comes free with Twisted. I have one problem though. As an upgrade, now, I have to send many requests as the same cl

Re: Entry Level Python Jobs

2009-09-03 Thread koranthala
On Sep 3, 9:19 am, steve wrote: > On 09/03/2009 09:36 AM, steve wrote: > > > Hi Jonathan, > > [...snip...] > > I feel stupid replying to my own post but just one more thing i thought about > mentioning but forgot to add: > - Look at your Liberal Arts major as an advantage. Every field has a > 'co

Re: executable path finding

2009-08-31 Thread koranthala
On Aug 31, 9:07 pm, "Diez B. Roggisch" wrote: > koranthala wrote: > > Hi, > >     I am creating a python application using py2exe. I am facing a > > problem which I am not sure how to solve. > >     The application contains many other files associated with

executable path finding

2009-08-31 Thread koranthala
Hi, I am creating a python application using py2exe. I am facing a problem which I am not sure how to solve. The application contains many other files associated with it - like icons, config files etc. The executable can be in any directory. If the user creates a shortcut to the executable

Re: can python make web applications?

2009-08-23 Thread koranthala
On Aug 23, 8:12 pm, Deep_Feelings wrote: > can python make powerfull database web applications that can replace > desktop database applications? e.g: entrprise accounting > programs,enterprise human resource management programs ...etc Very much so. The web frameworks, Django & TurboGears are quit

Twisted - how to get text for HTTP error responses

2009-08-09 Thread koranthala
Hi, I am writing a HTTP client in Twisted. The client contacts the server, and any errors in the sent messages will be returned back to the client in 400 message. The reason for failure at the server is sent as the text in the 400 message. I tried the same using the browser, and I can see the er

Re: Python docs disappointing - group effort to hire writers?

2009-08-08 Thread koranthala
On Aug 7, 5:15 pm, Dave Angel wrote: > alex23 wrote: > > Paul Rubin wrote: > > >> The PHP docs as I remember are sort of regular (non-publically > >> editable) doc pages, each of which has a public discussion thread > >> where people can post questions and answers ab

Re: My first wxPython App with Twisted - barebones version

2009-08-04 Thread koranthala
On Aug 5, 6:41 am, koranthala wrote: > Hi, >    I am creating the first GUI app (wxPython based) using Twisted. >    I am facing an issue which I cannot seem to solve/understand due > to lack of trace or anything. >    I had a big app written on twisted and now I am creating a lo

My first wxPython App with Twisted - barebones version

2009-08-04 Thread koranthala
Hi, I am creating the first GUI app (wxPython based) using Twisted. I am facing an issue which I cannot seem to solve/understand due to lack of trace or anything. I had a big app written on twisted and now I am creating a login screen to the app. The app used to work without any issues.

Re: My first wxPython App with Twisted

2009-08-04 Thread koranthala
On Aug 5, 6:29 am, koranthala wrote: > Hi, >    I am creating the first GUI app (wxPython based) using Twisted. >    I am facing an issue which I cannot seem to solve/understand due > to lack of trace or anything. > >    I had a big app written on twisted and now I am creating a

My first wxPython App with Twisted

2009-08-04 Thread koranthala
Hi, I am creating the first GUI app (wxPython based) using Twisted. I am facing an issue which I cannot seem to solve/understand due to lack of trace or anything. I had a big app written on twisted and now I am creating a login screen to the app. The app used to work without any issues

Re: Which GUI framework to use?

2009-08-04 Thread koranthala
On Aug 4, 11:48 am, "Diez B. Roggisch" wrote: > koranthala schrieb: > > > Hi, > >    I am creating a very minimal application (a networking app). > >    I have written the application using Twisted. > >    Now, I need to put a GUI wrapper on the applicati

Which GUI framework to use?

2009-08-03 Thread koranthala
Hi, I am creating a very minimal application (a networking app). I have written the application using Twisted. Now, I need to put a GUI wrapper on the application. The application needs a login screen and also it needs to be minimized to system tray. If I right click the image on system

Re: How to read webpage

2009-08-01 Thread koranthala
On Aug 1, 6:52 pm, MRAB wrote: > tarun wrote: > > Dear All, > > I want to read a webpage and copy the contents of it in word file. I > > tried to write following code: > > > import urllib2 > > urllib2.urlopen("http://www.rediff.com/";) > > > *Error:-* > > >     urllib2.urlopen("http://www.iciciban

Re: Einstein summation notation (was: question of style)

2009-07-16 Thread koranthala
> That test was designed to treat None as a boolean False, without > noticing that numeric 0 is also treated as False and could make the > test do the wrong thing. This is an extremely common type of error. Actually, I felt that 0 not being considered False would be a better option. I had lot of

Re: one more question

2009-07-15 Thread koranthala
On Jul 16, 7:30 am, alex23 wrote: > On Jul 15, 5:51 pm, koranthala wrote: > > >    I am not saying that what you said was wrong, only that I felt that > > she got tense looking up regular expressions. So a python reply which > > basically does the basic checking without

Re: mail

2009-07-15 Thread koranthala
On Jul 15, 11:46 pm, amr...@iisermohali.ac.in wrote: > Dear all, > > Sorry that I am disturbing you all again and again but this is the way I > am trying to solve my problem:--- > > >>> import re > >>> exp = re.compile("CA") > >>> infile = open("file1.txt") > >>> for line in infile: > > ...     val

Re: one more question

2009-07-15 Thread koranthala
On Jul 15, 11:56 am, alex23 wrote: > On Jul 15, 4:50 pm, alex23 wrote: > > > amr...@iisermohali.ac.in wrote: > > > I tried but its not coming. > > > How much are you prepared to pay for help with this? Or are you just > > asking us to do all the work for you? > > Or to be a _little_ less blunt: i

Re: one more question

2009-07-15 Thread koranthala
On Jul 15, 11:13 am, amr...@iisermohali.ac.in wrote: > Dear all, > > Just one more thing i want to ask that suppose i have a file like:--- > >  47     8   ALA       H     H      7.85     0.02     1 >  48     8   ALA       HA    H      2.98     0.02     1 >  49     8   ALA       HB    H      1.05  

Re: Recipes for trace statements inside python programs?

2009-06-25 Thread koranthala
On Jun 25, 1:40 pm, Francesco Bochicchio wrote: > Sorry, hit the send button by mistake ... > The definition of the trace function should be like: > > if __debug__ : >    def TRACE(*args): >      if  trace_enabled(): print "TRACE(%s) : %s " % ( context(), >                               " ".join(

Re: Matplotlib - an odd problem

2009-06-24 Thread koranthala
On Jun 25, 2:55 am, Jean-Paul Calderone wrote: > On Wed, 24 Jun 2009 11:38:02 -0700 (PDT), koranthala > wrote: > >Hi, > >I am using Matplotlib with Django to display charts on the web page. > >I am facing an odd problem in that, everytime I do a refresh on the > &

Matplotlib - an odd problem

2009-06-24 Thread koranthala
Hi, I am using Matplotlib with Django to display charts on the web page. I am facing an odd problem in that, everytime I do a refresh on the web page, the image darkens - and the text becomes little unreadable. 5/6 refreshes later, the text becomes completely unreadable. Since I am using Django tes

Re: On the property function

2009-06-16 Thread koranthala
On Jun 16, 9:19 am, Chris Rebert wrote: > On Mon, Jun 15, 2009 at 5:43 AM, Virgil Stokes wrote: > > Does anyone have a good example (or examples) of when "property(...)" can be > > useful? > > Erm, when you want to create a property (i.e. computed attribute). > > from __future__ import division >

Re: Good books in computer science?

2009-06-15 Thread koranthala
> There are huge numbers (millions?) of lousy programmers who program every > single day and never become good programmers. I think I can attest to that. I was a programmer (in a low level language) in a huge MNC code monkey shop for > 7 years. I consider myself to be Ok - not great, but not very

Re: Good books in computer science?

2009-06-13 Thread koranthala
On Jun 14, 1:52 am, "Rhodri James" wrote: > On Sat, 13 Jun 2009 18:37:13 +0100, koranthala   > wrote: > > > > >> Code Complete and GOF are software engineering books but not really > >> CS books. > > > I understand and concur. Since I am a

Re: Good books in computer science?

2009-06-13 Thread koranthala
> Code Complete and GOF are software engineering books but not really > CS books. I understand and concur. Since I am a software engineer - coming in to software from a different background - what I am looking for is self- improvement books for a software engineer. This can include both CS and So

Good books in computer science?

2009-06-13 Thread koranthala
Hi all, I do understand that this is not a python question and I apologize for that straight up. But I am a full time follower of this group and I have seen very very brilliant programmers and solutions. I also want to be a good programmer - so this question. Which are the classic

Re: Multi-Threading and KeyboardInterrupt

2009-06-13 Thread koranthala
On Jun 13, 10:25 am, Mike Kazantsev wrote: > On Thu, 11 Jun 2009 22:35:15 -0700 > Dennis Lee Bieber wrote: > > > > > On Thu, 11 Jun 2009 08:44:24 -0500, "Strax-Haber, Matthew (LARC-D320)" > > declaimed the following in > > gmane.comp.python.general: > > > > I sent this to the Tutor mailing list

Re: Creating temperory files for a web application

2009-05-08 Thread koranthala
On May 8, 5:22 pm, koranthala wrote: > On May 8, 2:49 pm, "Diez B. Roggisch" wrote: > > > > > koranthala wrote: > > > Hi, > > >    I am doing web development using Django. I need to create an image > > > (chart) and show it to the users - b

Re: Creating temperory files for a web application

2009-05-08 Thread koranthala
On May 8, 2:49 pm, "Diez B. Roggisch" wrote: > koranthala wrote: > > Hi, > >    I am doing web development using Django. I need to create an image > > (chart) and show it to the users - based on some data which user > > selects. > >    My question is

Creating temperory files for a web application

2009-05-08 Thread koranthala
Hi, I am doing web development using Django. I need to create an image (chart) and show it to the users - based on some data which user selects. My question is - how do I create a temporary image for the user? I thought of tempfile, but I think it will be deleted once the process is done - wh

Reg: MFC71.DLL

2009-05-03 Thread koranthala
Hi, I had written a python 2.4 program. When I made it to an executable with py2exe, it told that the mfc71.dll is not added - so I may have to ship it separately. It also showed many other dll's which are all in windows/system32 - which again it said is not added. Now, I have two questions -

Re: Help with setting up Tkinter

2009-04-08 Thread koranthala
On Apr 8, 1:20 pm, Eclipse wrote: > G'day All > > I was following the instructions (listed at bottom of post) from the > PythonInfo Wiki which says to run three tests. > > I ran the tests and test 1 and 2 worked > > Test 3 gave me an error - > > can anyone help ??? > > Tks in advance > > Pete > >

Re: converting a string to a function parameter

2009-03-13 Thread koranthala
On Mar 13, 1:01 pm, Chris Rebert wrote: > On Fri, Mar 13, 2009 at 12:52 AM, koranthala wrote: > > Hi, > >    Is it possible to convert a string to a function parameter? > > Ex: > > str = 'True, type=rect, sizes=[3, 4]' > > and I should be able t

converting a string to a function parameter

2009-03-13 Thread koranthala
Hi, Is it possible to convert a string to a function parameter? Ex: str = 'True, type=rect, sizes=[3, 4]' and I should be able to use it as: test(convert(str)) and the behaviour should be same as calling test with those values : i.e. test(True, type=rect, sizes=[3, 4]) I tried eval, but it did

Re: Implementing chain of responsibility

2009-03-09 Thread koranthala
On Mar 9, 12:16 pm, Chris Rebert wrote: > On Sun, Mar 8, 2009 at 11:53 PM, koranthala wrote: > > Hi, > >    I want to implement chain of responsibility pattern in Python (for > > a Django project) > >    The problem that I see is a rather odd one - how to link the &g

Implementing chain of responsibility

2009-03-08 Thread koranthala
Hi, I want to implement chain of responsibility pattern in Python (for a Django project) The problem that I see is a rather odd one - how to link the subclasses with the super class. Ex: Suppose the two child classes are as given below (A1, A2 child classes of A) class A: ... class A1(

Re: 2.6.1 - simple division

2009-03-08 Thread koranthala
On Mar 8, 7:22 pm, farsi...@gmail.com wrote: > On Mar 8, 2:16 pm, farsi...@gmail.com wrote: > > > >>> 4 / 5.0 > > > 0.84>>> 0.8 * 5 > > > 4.0 > > > python 2.6.1 on mac. What the hell is going on here? > > Pure curiosity prompted me to try the following:>>> 40 / 5.0 > > 8.0 > > Stran

Re: Server programming

2009-03-03 Thread koranthala
On Mar 3, 8:09 pm, Bruno Desthuilliers wrote: > koranthala a écrit : > (snip) > > > Hi Bruno, > >    After reading your email, I tried reworking my code so that most of > > my logic moves to Models. > >    But, most probably because this is my first application &

Re: Server programming

2009-03-03 Thread koranthala
On Feb 24, 1:02 am, Bruno Desthuilliers wrote: > koranthalaa écrit : > > > Hi, > >       Is server programming in Python procedure oriented or object > > oriented? > > It's how you want it to be. > > >       I have this question because lately I am asked to make a medium > > complex web program (e

Re: file locking...

2009-03-01 Thread koranthala
On Mar 1, 2:28 pm, Nigel Rantor wrote: > bruce wrote: > > Hi. > > > Got a bit of a question/issue that I'm trying to resolve. I'm asking > > this of a few groups so bear with me. > > > I'm considering a situation where I have multiple processes running, > > and each process is going to access a nu

Server programming

2009-02-23 Thread koranthala
Hi, Is server programming in Python procedure oriented or object oriented? I have this question because lately I am asked to make a medium complex web program (extremely database oriented) using Django. When I used to do application programs earlier (in Python itself), the whole thing b

Re: Killing subservient threads

2009-02-20 Thread koranthala
On Feb 20, 9:47 pm, jimzat wrote: > I am trying to create an app which will have a main window from which > the user will launch other (children) windows. > > When I launch the child window I start a new thread which periodically > polls another device and updates the child window accordingly.  Wh

Re: self-aware list of objects able to sense constituent member alterations?

2009-01-28 Thread koranthala
On Jan 28, 10:39 pm, Reckoner wrote: > On Jan 28, 9:16 am, koranthala wrote: > > > > > On Jan 28, 5:42 pm, koranthala wrote: > > > > On Jan 28, 2:16 am, Reckoner wrote: > > > > > I'm not sure this is possible, but I would like to have >

Re: self-aware list of objects able to sense constituent member alterations?

2009-01-28 Thread koranthala
On Jan 28, 5:42 pm, koranthala wrote: > On Jan 28, 2:16 am, Reckoner wrote: > > > > > I'm not sure this is possible, but I would like to have > > a list of  objects > > > A=[a,b,c,d,...,z] > > > where,  in the midst of a lot of

Re: A Twisted Design Decision

2009-01-28 Thread koranthala
> You can still interact via return values.  You should be thinking about > a Deferred in the same way as you think about a function which returns > a result synchronously.  The Deferred represents the result, even though > it isn't the result itself (since the result doesn't exist yet).  Anything

Re: A Twisted Design Decision

2009-01-28 Thread koranthala
On Jan 28, 8:36 pm, Jean-Paul Calderone wrote: > On Wed, 28 Jan 2009 06:30:32 -0800 (PST), koranthala > wrote: > >On Jan 28, 7:10 pm, Jean-Paul Calderone wrote: > >> On Wed, 28 Jan 2009 02:02:57 -0800 (PST), koranthala > >> wrote: > >> >On Jan 27,

Re: A Twisted Design Decision

2009-01-28 Thread koranthala
On Jan 28, 7:10 pm, Jean-Paul Calderone wrote: > On Wed, 28 Jan 2009 02:02:57 -0800 (PST), koranthala > wrote: > >On Jan 27, 9:27 pm, koranthala wrote: > >> On Jan 27, 6:57 pm, Jean-Paul Calderone wrote: > > [snip] > > >> Thank you Jean-Paul. > &

Re: self-aware list of objects able to sense constituent member alterations?

2009-01-28 Thread koranthala
On Jan 28, 2:16 am, Reckoner wrote: > I'm not sure this is possible, but I would like to have > a list of  objects > > A=[a,b,c,d,...,z] > > where,  in the midst of a lot of processing I might do something like, > > A[0].do_something_which_changes_the_properties() > > which alter the properties of

Re: A Twisted Design Decision

2009-01-28 Thread koranthala
On Jan 27, 9:27 pm, koranthala wrote: > On Jan 27, 6:57 pm, Jean-Paul Calderone wrote: > > > > > On Tue, 27 Jan 2009 05:46:25 -0800 (PST), koranthala > > wrote: > > >Twisted, being twisted in its behavior is causing quite a lot of > > >confusion in de

Re: A Twisted Design Decision

2009-01-27 Thread koranthala
On Jan 27, 6:57 pm, Jean-Paul Calderone wrote: > On Tue, 27 Jan 2009 05:46:25 -0800 (PST), koranthala > wrote: > >Twisted, being twisted in its behavior is causing quite a lot of > >confusion in design decisions. > > I'm not sure I agree with your premise. ;)

A Twisted Design Decision

2009-01-27 Thread koranthala
Twisted, being twisted in its behavior is causing quite a lot of confusion in design decisions. I will put forward a comparison of reactor and non-reactor patterns. The code is not exact - whatever is shown is the gist of it. For example, a message handler - in a usual scenario: class messageHand

Re: Logging help

2009-01-22 Thread koranthala
On Jan 22, 10:25 pm, Vinay Sajip wrote: > On Jan 22, 3:40 pm,koranthala wrote: > > > Thank you very much Vinay. You have been extremely helpful. > > This was my first design - but then I found that log system was taking > > up quite a huge chunk of the memory. > >

Re: Logging help

2009-01-22 Thread koranthala
On Jan 22, 2:14 pm, Vinay Sajip wrote: > On Jan 22, 6:49 am,koranthala wrote: > > > I understand Vinay. But my point is that I wanted a mechanism to > > rotate the log files based on data - i.e. today one log, tomorrow > > Did you mean "based on date"? > >

Dictionary : items()

2009-01-21 Thread koranthala
Hi, Dictionary has the items method which returns the value as a list of tuples. I was wondering whether it would be a good idea to have an extra parameter - sort - to allow the tuples to be sorted as the desire of users. Currently what I do is: class SDict(dict): def items(self, sort

Re: Logging help

2009-01-21 Thread koranthala
On Jan 21, 2:55 pm, Vinay Sajip wrote: > On Jan 20, 10:11 am,koranthala wrote: > > > > > The doRollover method does not append to the earlier file. Rather, it > > creates a new file with the same name. > > Err... that's what rollover means - switching to a n

Re: Logging help

2009-01-20 Thread koranthala
On Jan 20, 5:45 am, Chris Rebert wrote: > On Mon, Jan 19, 2009 at 11:36 AM, koranthala wrote: > > Hi, > >   Is it possible somehow to have the logging module rotate the files > > every time I start it. > >   Basically, I can automatically rotate using RotatingFil

Logging help

2009-01-19 Thread koranthala
Hi, Is it possible somehow to have the logging module rotate the files every time I start it. Basically, I can automatically rotate using RotatingFileHandler; Now I want it rotated every time I start the program too. Ex: The logging file - log.txt Now, rotatingfilehandler goes and updat

Python Style Guide Questions - Contd.

2009-01-19 Thread koranthala
Hi, I have some more questions about python code styling. 1. Global Variables: In my code, I am using some global variables. Now, when I ran PyLint, it raised convention errors mentioning that they should be CAPITAL_ALPHABETS. Now, in PEP 8, I did not see that mentioned. Please let me know wh

Re: Start two threads in same time

2009-01-16 Thread koranthala
On Jan 16, 7:46 pm, koranthala wrote: > On Jan 16, 7:36 pm, vedrandeko...@gmail.com wrote: > > > Hello, > > > Does anybody know how can I start two threads in same time? > > > Regards, > > John > > Use threading mod

Re: Start two threads in same time

2009-01-16 Thread koranthala
On Jan 16, 7:36 pm, vedrandeko...@gmail.com wrote: > Hello, > > Does anybody know how can I start two threads in same time? > > Regards, > John Use threading module. Creating a new thread is as easy as -- --- import threading cla

Re: Python Style Guide Questions

2009-01-15 Thread koranthala
On Jan 16, 12:00 pm, Terry Reedy wrote: > koranthala wrote: > > Hi, > >    Which is more advisable? > > import x > > b = x.a > >              or > > from x import a > > b = a > > If I know I want just one thing from x, I tend to use latter. &g

Python Style Guide Questions

2009-01-15 Thread koranthala
Hi, Which is more advisable? import x b = x.a or from x import a b = a I read in Learning Python that it is always better to use the former - especially since namespace wont be dirtied. But, doing that with PEP 8 together causes my code to look rather cluttered. Reason being tha

Re: Python Crashes

2009-01-14 Thread koranthala
On Jan 15, 3:12 am, "James Mills" wrote: > On Thu, Jan 15, 2009 at 6:57 AM, koranthala wrote: > > Hi, > >    I have a twisted based application based on Python 2.4.3. I also > > have one thread in this application. > > >    I found that my program cr

Python Crashes

2009-01-14 Thread koranthala
Hi, I have a twisted based application based on Python 2.4.3. I also have one thread in this application. I found that my program crashes repeatedly after a random interval (ranging from 10 min to 3 hr). When I say crash, it is not just that the program dies. Rather in WinXP - a window com

Re: PYTHON HTTP POST

2009-01-14 Thread koranthala
On Jan 14, 2:21 pm, koranth...@gmail.com wrote: > Does google accept POST? > > Anyways, if you dont need to post files, you can use urlencode itself. > def encode_formdata(fields): >         body = urllib.urlencode(dict()) >         content_type = "application/x-www-form-urlencoded" >         retur

Re: PYTHON HTTP POST

2009-01-14 Thread koranthala
Does google accept POST? Anyways, if you dont need to post files, you can use urlencode itself. def encode_formdata(fields): body = urllib.urlencode(dict()) content_type = "application/x-www-form-urlencoded" return content_type, body If you need to post files too, then you

Re: Python strings and coding conventions

2009-01-10 Thread koranthala
On Jan 11, 9:26 am, Robert Kern wrote: > koranth...@gmail.com wrote: > > Hi, > >    Python Coding Convention (PEP 8) suggests : > >   Maximum Line Length > > >     Limit all lines to a maximum of 79 characters. > > >   I have a string which is ~110 char long. It is a string which I am > > going to

Python strings and coding conventions

2009-01-10 Thread koranthala
Hi, Python Coding Convention (PEP 8) suggests : Maximum Line Length Limit all lines to a maximum of 79 characters. I have a string which is ~110 char long. It is a string which I am going to print in a text file as a single string. i.e. in that text file, each line is taken as a diff

Re: Encrypted Logging in python

2009-01-09 Thread koranthala
On Jan 9, 3:16 pm, Steven D'Aprano wrote: > On Fri, 09 Jan 2009 00:21:09 -0800, koranthala wrote: > > I was wondering if there is a mechanism to encrypt logging automatically > > in python. > >    The issue is as follows: > >     (a) An application (after py2exe)

Encrypted Logging in python

2009-01-09 Thread koranthala
I was wondering if there is a mechanism to encrypt logging automatically in python. The issue is as follows: (a) An application (after py2exe) will go as executable and there is no need for the user to know that it is written in python. If an exception occurs and it is logged, then the us

Python return values

2009-01-05 Thread koranthala
I have a newbie doubt about Python return values. In (say) C/C++, if we try to return a value which is stored inside the procedure stack, we will get an error when trying to access it outside of that procedure. For example: function foo(): dcl y int dcl x pointer to int pointing to y retu

Re: Doubt on creating threads

2009-01-03 Thread koranthala
On Jan 4, 4:59 am, Bryan Olson wrote: > koranth...@gmail.com wrote: > > I am creating an application and it creates ~1-2 threads every second > > and kill it within 10 seconds. After reading this I am worried. Is > > creating a thread a very costly operation? > > Compared to a procedure call it's

Doubt on creating threads

2009-01-03 Thread koranthala
I was going through Python posts and this post caught my attention http://groups.google.com/group/comp.lang.python/browse_thread/thread/f99326a4e5d394e/14cd708956bd1c1a#14cd708956bd1c1a You have missed an important point. A well designed application does neither create so many threads nor proce

Re: Python logging question

2009-01-02 Thread koranthala
e the connection was instantiated - e.g. with name "connection. > 20090102123456543", this would create hundreds of thousands of unique > logger instances and have a potentially adverse impact on process > memory. That's when you use LoggerAdapters. > > I hope that's clearer. > > Regards, > > Vinay Sajip Thank you very much Vinay. I was confused by the way it was mentioned in the tutorial. Again, Thank you Regards Koranthala -- http://mail.python.org/mailman/listinfo/python-list

Python logging question

2009-01-02 Thread koranthala
Hi, I was reading through Python Logging tutorial, and I found one scenario which I couldnt properly understand. The tutorial (http://docs.python.org/library/logging.html) mentions at first that -- "Multiple calls to getLogger() with the same name will return a reference to the same logger

Re: initialization in python

2009-01-01 Thread koranthala
On Jan 1, 11:14 pm, Terry Reedy wrote: > koranth...@gmail.com wrote: > >>> Module database: > >>> ^^^ > >>> Session = None > > 'Initializing' names is not necessary.  Delete this.  Without it, your > error would be more obvious. > > >>> def init(dbname): > >>>    engine = create_en

Re: Videocapture in python

2009-01-01 Thread koranthala
On Jan 1, 7:26 pm, Marc 'BlackJack' Rintsch wrote: > On Thu, 01 Jan 2009 04:28:21 -0800, koranthala wrote: > > Please let me know if you need any more information. > > Where does `videocapture.py` coming from?  It's not part of the standard > library.  And whic

Re: initialization in python

2009-01-01 Thread koranthala
On Jan 1, 6:54 pm, John Machin wrote: > On Jan 1, 11:44 pm, koranth...@gmail.com wrote: > > > > > How does an average product handle initialization in python? > > I am facing lot of issues in handling initialization, especially if I > > import specific variables, due to the variables not getting u

initialization in python

2009-01-01 Thread koranthala
How does an average product handle initialization in python? I am facing lot of issues in handling initialization, especially if I import specific variables, due to the variables not getting updated. For example - taking a sqlalchemy based product: Module database: ^^^ Session = No

Re: Videocapture in python

2009-01-01 Thread koranthala
On Jan 1, 1:58 pm, "alex goretoy" wrote: > Can you post your code or a code segment? I would be interested in seeing > how this works. > > > > On Thu, Jan 1, 2009 at 3:29 AM, wrote: > > I face issues in videocapture in python. Cant find anyplace where we > > can raise bug reports, so mentioning h

Videocapture in python

2008-12-31 Thread koranthala
I face issues in videocapture in python. Cant find anyplace where we can raise bug reports, so mentioning here. Also help required if somebody has solved it earlier. On using videocapture (python 2.4), I am facing the following issues while creating a video sort of application. -> Pull out the usb