RE: [OT] Off-Topic Posts and Threads on the Python Mailing List

2011-09-30 Thread Navkirat Singh
Lol you all sound like google's angry birds with their feathers ruffled by a comment. You guys should open up another mailing list to extinguish your virtually bruised egos. . . . On Sep 30, 2011 10:27 PM, Prasad, Ramit ramit.pra...@jpmorgan.com wrote: --

Re: [OT] Benefit and belief

2011-09-29 Thread Navkirat Singh
Hi, I am looking for the python mailing list. . ? Have you guys seen it somewhere? I think I accidently reached the cry-me-a-river list? Regards, Nav On Sep 30, 2011 1:03 AM, Petite Abeille petite.abei...@gmail.com wrote: On Sep 29, 2011, at 8:49 PM, Devin Jeanpierre wrote: It could

Decision on python technologies

2011-09-22 Thread Navkirat Singh
Hi Guys, I have been a python developer for a bit now and for the life of me I am not being able to decide something. I am trying to develop a web based application in python. I am torn between using python 2 or 3. All the good frameworks are still in 2.x. Now, cherrypy, sqlalchemy and jinja2

How to handle application level errors

2011-08-26 Thread Navkirat Singh
Hi Guys, Not sure if this is the place to ask, but I am trying find out a way to handle application level errors from a global config. Any help would be really appreciated. Regards, Nav -- http://mail.python.org/mailman/listinfo/python-list

Sqlalchemy + Cherrypy

2011-08-18 Thread Navkirat Singh
Hi Guys, I am not sure if this is the right place to put this question. I am trying to figure out what the proper/clean way is to integrate cherrypy and sqlalchemy? I am currently trying to do this cherrypy 3 and sqlalchemy .7 in python 3.2 a) Cherrypy tools b) Integrate it directly into the app

Inheriting Object

2011-05-19 Thread Navkirat Singh
Hi Guys, I have been wondering for a while now as to why some classes inherit Object? And what does it really do for the class? Can anyone shed some light on this? Regards, Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheriting Object

2011-05-19 Thread Navkirat Singh
On Fri, May 20, 2011 at 8:25 AM, MRAB pyt...@mrabarnett.plus.com wrote: On 20/05/2011 03:13, Navkirat Singh wrote: Hi Guys, I have been wondering for a while now as to why some classes inherit Object? And what does it really do for the class? Can anyone shed some light on this? Read

Re: Memcached in python 3

2011-05-16 Thread Navkirat Singh
15, 2011 at 9:52 PM, Navkirat Singh n4vpyt...@gmail.comwrote: Hi Guys, How can I used memcached with python 3? Are there any other good alternatives to memcached? What about python dictionary manager, would it compare to memcached if I were to use it for storing in-memory information? Any

Python 3 vs Python 2.7 dilemma

2011-05-16 Thread Navkirat Singh
Hi Guys, I have been trying to fight this issue for sometime now. I know that a large part of the python 3rd party software base has not been ported to python 3 yet. I am trying to build a web-based enterprise solution for my client. Most of reputed frameworks like Django and Turbo gears are yet

recvall()

2011-05-15 Thread Navkirat Singh
Hi All, I am trying to program an HTTP webserver, I am a little confused about the best way to program a recvall function. There are a couple of ways to do this? But performance wise which one is better? a) recvall using a timeout? b) recvall using a condition that nothing was received? c)

Memcached in python 3

2011-05-15 Thread Navkirat Singh
Hi Guys, How can I used memcached with python 3? Are there any other good alternatives to memcached? What about python dictionary manager, would it compare to memcached if I were to use it for storing in-memory information? Any light on this matter will be appreciated. Regards, Navkirat --

Persistent Database Cursors

2010-11-20 Thread Navkirat Singh
Hi Guys, I am having trouble with database cursors. I am using py-postgresql cursors to fetch data over HTTP. I want to be able to refer to the cursor over multiple HTTP requests. Any light on this matter would be of great help. Regards, Nav --

Pickling a database cursor?

2010-11-20 Thread Navkirat Singh
Hi Guys, Is there any way to pickle a database cursor? I would like a persistent cursor over multiple HTTP requests. Any help would be awesome ! Nav -- http://mail.python.org/mailman/listinfo/python-list

Webcam support

2010-08-26 Thread Navkirat Singh
Hi Guys, I am programming a web centric app in python for customer, which needs to click a snap of the customer and forward the pic to the server via POST. I am not very familiar with how I can achieve this. Any direction would be much appreciated. Regards, Nav --

Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. I wanted to know how i could write the file (now a string) as a jpeg image on disk. When I try to encode the same string to a

Re: Webcam support

2010-08-26 Thread Navkirat Singh
On 26-Aug-2010, at 9:49 PM, garabik-news-2005...@kassiopeia.juls.savba.sk wrote: Navkirat Singh navkir...@gmail.com wrote: Hi Guys, I am programming a web centric app in python for customer, which needs to click a snap of the customer and forward the pic to the server via POST. I am

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 26-Aug-2010, at 11:01 PM, John Bokma wrote: Navkirat Singh navkir...@gmail.com writes: Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. Why? -- John Bokma

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
to an image, so I can save as a jpeg on disk. Regards, Nav On 27-Aug-2010, at 12:07 AM, Stefan Schwarzer wrote: Hi Navkirat, On 2010-08-26 19:22, Navkirat Singh wrote: I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 1:10 AM, Robert Kern wrote: On 8/26/10 1:25 PM, Navkirat Singh wrote: On 26-Aug-2010, at 11:01 PM, John Bokma wrote: Navkirat Singhnavkir...@gmail.com writes: Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 12:45 AM, MRAB wrote: On 26/08/2010 19:57, Navkirat Singh wrote: I am sorry, maybe I was not elaborate in what I was having trouble with. I am using a jpegcam library, which on my web page captures a webcam image and sends it to the server via the POST method

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote: Navkirat Singh wrote: Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. I wanted to know how i could write the file (now

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote: Navkirat Singh wrote: Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. I wanted to know how i could write the file (now

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 1:57 AM, MRAB wrote: On 26/08/2010 21:14, Navkirat Singh wrote: On 27-Aug-2010, at 1:32 AM, Dave Angel wrote: Navkirat Singh wrote: Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 2:14 AM, Brad wrote: On Aug 25, 4:05 am, Alex McDonald b...@rivadpm.com wrote: Your example of writing code with memory leaks *and not caring because it's a waste of your time* makes me think that you've never been a programmer of any sort. Windows applications are

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 1:57 AM, MRAB wrote: On 26/08/2010 21:14, Navkirat Singh wrote: On 27-Aug-2010, at 1:32 AM, Dave Angel wrote: Navkirat Singh wrote: Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 2:40 AM, Robert Kern wrote: On 8/26/10 3:47 PM, Navkirat Singh wrote: On 27-Aug-2010, at 1:57 AM, MRAB wrote: On 26/08/2010 21:14, Navkirat Singh wrote: On 27-Aug-2010, at 1:32 AM, Dave Angel wrote: Navkirat Singh wrote: Hey guys, I am programming a webserver

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 2:48 AM, MRAB wrote: On 26/08/2010 21:47, Navkirat Singh wrote: On 27-Aug-2010, at 1:57 AM, MRAB wrote: On 26/08/2010 21:14, Navkirat Singh wrote: On 27-Aug-2010, at 1:32 AM, Dave Angel wrote: Navkirat Singh wrote: Hey guys, I am programming a webserver, I

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 2:58 AM, Navkirat Singh wrote: On 27-Aug-2010, at 2:48 AM, MRAB wrote: On 26/08/2010 21:47, Navkirat Singh wrote: On 27-Aug-2010, at 1:57 AM, MRAB wrote: On 26/08/2010 21:14, Navkirat Singh wrote: On 27-Aug-2010, at 1:32 AM, Dave Angel wrote: Navkirat Singh

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 3:02 AM, Robert Kern wrote: On 8/26/10 4:17 PM, Navkirat Singh wrote: Here is what I needed to do: a) Separate image content from header content of the byte stream received from the web browser. b) Save the image content to disk for further use. Here is what I did

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 3:04 AM, Robert Kern wrote: On 8/26/10 4:25 PM, Navkirat Singh wrote: @Robert - Thanks a lot for your time :-) , I did know that the body starts after the occurrence two CRLF sequences, but I was following RFC2616 as a guide, which specifically mentions

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 3:15 AM, Robert Kern wrote: On 8/26/10 4:17 PM, Navkirat Singh wrote: #-HERE IS WHERE I RECEIVE THE DATA while True: buff = socket.recv(8192) byteStr +=buff if not buff: break Also, you probably shouldn't

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
On 27-Aug-2010, at 4:23 AM, Terry Reedy wrote: On 8/26/2010 5:28 PM, Navkirat Singh wrote: b = b'asdf' type(b) class 'bytes' s = b.split(':') You are trying to split bytes with a string, which is impossible. Split bytes with bytes, strings with strings. Traceback (most recent call

Re: Iterative vs. Recursive coding

2010-08-20 Thread Navkirat Singh
On 20-Aug-2010, at 1:17 PM, News123 wrote: On 08/20/2010 02:26 AM, Steven D'Aprano wrote: On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote: Recursion can be quite a trick to get your mind round at first Really? Do people actually find the *concept* of recursion to be tricky? Is

Re: Using the print command in Python3

2010-08-10 Thread Navkirat Singh
On 10-Aug-2010, at 11:04 AM, Benjamin Kaplan wrote: On Mon, Aug 9, 2010 at 10:17 PM, Grady Knotts gradykno...@gmail.com wrote: In earlier versions of Python I can do: print 'A', print 'B' to print everything on the same line: 'A B' But I don't know how to do this with

favicon.ico problem

2010-08-09 Thread Navkirat Singh
Hi guys, I am having this strange problem. I have programmed a very basic multiprocessing webserver using low level sockets. Each time the server receives a request it spawns a new process to handle the request. Now when through a web browser I type http://localhost:8001/ it automatically

Re: favicon.ico problem

2010-08-09 Thread Navkirat Singh
On 10-Aug-2010, at 10:57 AM, Xia, Zhen wrote: On Tue, 10 Aug 2010 10:02:49 +0530 Navkirat Singh navkir...@gmail.com wrote: Hi guys, I am having this strange problem. I have programmed a very basic multiprocessing webserver using low level sockets. Each time the server receives

Re: Import python modules from sub-directories

2010-08-06 Thread Navkirat Singh
On 06-Aug-2010, at 1:13 PM, 夏震 wrote: Hi guys, I am new to python and would like to import certain classes in sub-directories of the working directory. I was wondering how will I be able to achieve this? Regards, Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: new to python - trouble calling a function from another function

2010-08-05 Thread Navkirat Singh
I was looking at the code, I dont have much time to go through it, but I might have found a typo - yield (p.destination - self.currenteFloor) , I think it should be currentFloor.Maybe thats your problem. Will look into the code more later. Regards, Nav On 05-Aug-2010, at 12:55 PM, Brandon

Import python modules from sub-directories

2010-08-05 Thread Navkirat Singh
Hi guys, I am new to python and would like to import certain classes in sub-directories of the working directory. I was wondering how will I be able to achieve this? Regards, Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: Import python modules from sub-directories

2010-08-05 Thread Navkirat Singh
On 06-Aug-2010, at 10:44 AM, Navkirat Singh wrote: Hi guys, I am new to python and would like to import certain classes in sub-directories of the working directory. I was wondering how will I be able to achieve this? Regards, Nav Thanks. I got it. I just put an empty __init__.py

Re: Global variables problem

2010-08-04 Thread Navkirat Singh
as expected. I don't know much about the multiprocessing module, so I can't really comment on what you're doing wrong, but I hope this points you in the right direction. Sorry I couldn't be of more help, Daniel On Tue, Aug 3, 2010 at 9:48 PM, Navkirat Singh navkir...@gmail.com wrote

Re: Global variables problem

2010-08-04 Thread Navkirat Singh
: ( False alarm, the earlier solution breaks multiprocessing. Whats happening here is the child needs to change a variable in the parent process, So I think I am looking at shared memory (maybe). Any suggestions? Regards, Nav On 04-Aug-2010, at 12:41 PM, Navkirat Singh wrote: Thanks

Difference between queues and pipes in multiprocessing

2010-08-04 Thread Navkirat Singh
Hi, I was wondering what are the differences between queues and pipes implemented using multiprocessing python module. Am I correct if I say, in pipes, if another process writes to one receiving end concurrently, then an error will be raised and in queues the later processes data will just

Global variables problem

2010-08-03 Thread Navkirat Singh
Hey guys, I am using a multiprocessing program, where the new process is supposed to change a variable in the main class that it branches out from. This is somehow not working, following is an approximate code. Would really appreciate any insight into this matter: var = {} class

Re: Global variables problem

2010-08-03 Thread Navkirat Singh
On 04-Aug-2010, at 9:46 AM, Daniel da Silva wrote: Please post approximate code that actually works and displays the problem. On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh navkir...@gmail.com wrote: Hey guys, I am using a multiprocessing program, where the new process is supposed

Re: Performance ordered dictionary vs normal dictionary

2010-07-29 Thread Navkirat Singh
On 29-Jul-2010, at 11:41 AM, Chris Rebert wrote: On Wed, Jul 28, 2010 at 8:12 PM, Navkirat Singh navkir...@gmail.com wrote: Sorry, I might have been a bit vague: (Also, I am new to pythong) I am trying to do construct my own web session tracking algorithm for a web server (which also I have

Re: Performance ordered dictionary vs normal dictionary

2010-07-29 Thread Navkirat Singh
On 29-Jul-2010, at 2:50 PM, Hrvoje Niksic wrote: sturlamolden sturlamol...@yahoo.no writes: On 29 Jul, 03:47, Navkirat Singh navkir...@gmail.com wrote: I was wondering what would be better to do some medium to heavy book keeping in memory - Ordered Dictionary or a plain simple

Performance ordered dictionary vs normal dictionary

2010-07-28 Thread Navkirat Singh
Hi guys, I was wondering what would be better to do some medium to heavy book keeping in memory - Ordered Dictionary or a plain simple Dictionary object?? Regards, N4v -- http://mail.python.org/mailman/listinfo/python-list

Function parameter scope

2010-07-28 Thread Navkirat Singh
Hi, I had another question: What is the scope of a parameter passed to a function? I know its a very basic question, but I am just sharpening my basics :) def func_something(x) return print(x+1); Does x become a local variable or does it stay as a module scoped variable? Though I

Re: Performance ordered dictionary vs normal dictionary

2010-07-28 Thread Navkirat Singh
On 29-Jul-2010, at 9:36 AM, sturlamolden wrote: On 29 Jul, 03:47, Navkirat Singh navkir...@gmail.com wrote: I was wondering what would be better to do some medium to heavy book keeping in memory - Ordered Dictionary or a plain simple Dictionary object?? It depends on the problem

Re: Socket performance

2010-07-25 Thread Navkirat Singh
On 25-Jul-2010, at 5:52 PM, Roy Smith wrote: In article 4c4bd0b1$0$1624$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: 1. When writing to a TCP socket, write everything you have to write with one send or write operation if at all possible. Don't write a

Multiprocessing zombie processes

2010-07-24 Thread Navkirat Singh
Hi, I have been meddling around with forking and multiprocessing. Now both of them spawn new processes from parent (atleast from what I have understood). I have been able to reproduce a zombie state in a fork with: import os,time print('before fork',os.getpid()) pid = os.fork() if pid:

Re: Multiprocessing zombie processes

2010-07-24 Thread Navkirat Singh
OK I wanted zombie processes and have been able to regenerate them with multiprocessing. Now lets see how I can handle them. Nav On 25-Jul-2010, at 4:37 AM, Navkirat Singh wrote: Hi, I have been meddling around with forking and multiprocessing. Now both of them spawn new processes from

Re: Multiprocessing zombie processes

2010-07-24 Thread Navkirat Singh
I want to kill Zombiesso first I have to create them...simple law of nature On 25-Jul-2010, at 5:08 AM, Chris Rebert wrote: On Sat, Jul 24, 2010 at 4:11 PM, Navkirat Singh navkir...@gmail.com wrote: OK I wanted zombie processes snip Now lets see how I can handle them. Paging Dr

Re: Multiprocessing zombie processes

2010-07-24 Thread Navkirat Singh
On 25-Jul-2010, at 5:25 AM, Cameron Simpson wrote: [ Please don't top post. Post below so that things read like a conversation. (And trim excess quoted junk.) It doesn't take long and makes things a lot easier for your readers. ] On 25Jul2010 04:41, Navkirat Singh navkir...@gmail.com

Re: Socket performance

2010-07-24 Thread Navkirat Singh
On 25-Jul-2010, at 6:45 AM, Lawrence D'Oliveiro wrote: In message mailman.1097.1279930004.1673.python-l...@python.org, Navkirat Singh wrote: I had a question, programming sockets, what are the things that would degrade performance and what steps could help in a performance boost

Socket performance

2010-07-23 Thread Navkirat Singh
Hey Everyone, I had a question, programming sockets, what are the things that would degrade performance and what steps could help in a performance boost? I would also appreciate being pointed to some formal documentation or article. I am new to this. Warm regards, Nav --

Re: Socket performance

2010-07-23 Thread Navkirat Singh
since the documentation was written? Sorry I might be asking too many question, I am pretty new to this stuff and kinda feel lost here and there : ( Thanks, Nav On 24-Jul-2010, at 6:34 AM, MRAB wrote: Navkirat Singh wrote: Hey Everyone, I had a question, programming sockets, what

Sending HTTP headers via plain sockets

2010-07-22 Thread Navkirat Singh
Hi Guys, I am very new to python and I am trying to send HTTP headers for redirection using sockets in python 3, but in vain. If I use the meta tag REFRESH method the redirection works. Please advise what I am missing, below is the snippet of my code: hostsock is the socket object

Re: Sending HTTP headers via plain sockets

2010-07-22 Thread Navkirat Singh
-2010, at 7:00 AM, Navkirat Singh wrote: Hi Guys, I am very new to python and I am trying to send HTTP headers for redirection using sockets in python 3, but in vain. If I use the meta tag REFRESH method the redirection works. Please advise what I am missing, below is the snippet of my code