Re: (don't bash me too hard) Python interpreter in JavaScript

2011-11-20 Thread OKB (not okblacke)
Carl Banks wrote: > Some people have already made an LLVM-to-Javascript compiler, and > have managed to build Python 2.7 with it. > > The LLVM-to-Javascript project is called emscripten. > > https://github.com/kripken/emscripten/wiki > > Demo of Python (and a bunch of other languages) here: >

Interesting problem about uuid1

2011-11-20 Thread sword
My colleague asks me an interesting problem about uuid library in python. In multicore system with multiprocessing, is it possible to get the duplicated uuid with uuid1? I just check the RFC 4122, and I can't find anything about multicore environment. Python's uuid1 method generates the uuid with

request of "real timeout" in socket.read

2011-11-20 Thread 顺航 游
Hi, few days ago I was confused with the behavior of socket.read when timeout is used -- that the lifespan of the operation often is longer than the time I've specified. So I go to python.org and get the source code of python. Yet I had read some lines of code from the Python-2.7.2/Modules/ socketm

Re: Got some problems when using logging Filter

2011-11-20 Thread sword
On Nov 20, 8:42 am, Vinay Sajip wrote: > On Nov 17, 9:06 am, sword wrote: > > > > > > > > > > > On Nov 16, 10:50 pm, Peter Otten <__pete...@web.de> wrote: > > > > sword wrote: > > > > Thanks for your reply. I tried to edit the source a bit, now the > > > > main.py looks like this: > > > > #main.p

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Chris Angelico
On Mon, Nov 21, 2011 at 4:44 PM, Steven D'Aprano wrote: > On Mon, 21 Nov 2011 13:33:21 +1100, Chris Angelico wrote: > >> What's your language's "special feature"? I like to keep track of >> languages using a "slug" - a simple one-sentence (or less) statement of >> when it's right to use this langu

Re: ProgressBar - Python and Powershell

2011-11-20 Thread Alec Taylor
So you're executing Powershell commands into Virtual Machines? Add this into the installer (probably WiX is your best bet) On Mon, Nov 21, 2011 at 3:40 AM, wrote: > Thanks for reply. > Python and Powershell are required because the installer would deal in > virtual machines ( VMware environmen

Re: Server Questions (2 of them)

2011-11-20 Thread Nizamov Shawkat
2011/11/20 Andrew : > Hello List, > > How to do you create a server that accepts a set of user code? > > For example, > > I would like to send this function: > def addition(x,y): >   return x+y > and have the socket server perform the operation and send is back to > the end user. > > Question 2: >

Close as Many Files/External resourcs as possible in the face of exceptions

2011-11-20 Thread GZ
Hi, Here is my situation. A parent object owns a list of files (or other objects with a close() method). The close() method can sometimes fail and raise an exception. When the parent object's close() method is called, it needs to close down as many files it owns as possible, even if the close() fu

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Steven D'Aprano
On Mon, 21 Nov 2011 13:33:21 +1100, Chris Angelico wrote: > What's your language's "special feature"? I like to keep track of > languages using a "slug" - a simple one-sentence (or less) statement of > when it's right to use this language above others. For example, Python > is optimized for 'rapid

Re: Both Python 2.5.2 and 2.7.2 flop the same way under Win 7

2011-11-20 Thread alex23
On Nov 19, 8:31 am, Stephen Hansen wrote: > Yes, its moderately annoying that you have to do this yourself; maybe > you wouldn't if you installed 64-bit python, but I can't be sure. Maybe > it has nothing to do with 32 or 64-bitness at all and my guess is wrong. I've got the 32 bit version of 2.7

Re: Both Python 2.5.2 and 2.7.2 flop the same way under Win 7

2011-11-20 Thread alex23
On Nov 19, 3:59 am, "W. eWatson" wrote: > Yes. I tried running it. Got nowhere. Did you run it from the shell? Did it spit out any errors? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there any way to unimport a library

2011-11-20 Thread alex23
On Nov 21, 1:15 am, Gelonida N wrote: > I wondered whether there is any way to un-import a library, such, that > it's occupied  memory and the related shared libraries are released. > > My usecase is following: > > success = False > try: >     import lib1_version1 as lib1 >     import lib2_version

Re: Server Questions (2 of them)

2011-11-20 Thread alex23
On Nov 21, 10:27 am, Christian Heimes wrote: > It's possible to sandbox Python code, see > http://docs.python.org/library/rexec.html Although this has been deprecated since 2.6 & removed from 3.x (and cautioned against for as long as I've used Python). PyPy provides some sandboxing functionality

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Dan Stromberg
On Sun, Nov 20, 2011 at 4:46 PM, Travis Parks wrote: > Hello: > > I am currently working on designing a new programming language. It is > a compiled language, but I still want to use Python as a reference. > Python has a lot of similarities to my language, such as indentation > for code blocks, la

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Chris Angelico
On Mon, Nov 21, 2011 at 11:46 AM, Travis Parks wrote: > I am currently working on designing a new programming language. It is > a compiled language, but I still want to use Python as a reference. > Python has a lot of similarities to my language, such as indentation > for code blocks, lambdas, non

Re: (don't bash me too hard) Python interpreter in JavaScript

2011-11-20 Thread Lorenzo
On Nov 15, 11:51 pm, Carl Banks wrote: > Some people have already made an LLVM-to-Javascript compiler, and have > managed to build Python 2.7 with it. > > The LLVM-to-Javascript project is called emscripten. > > https://github.com/kripken/emscripten/wiki > > Demo of Python (and a bunch of other l

Re: scraping a tumblr.com archive page

2011-11-20 Thread Jabba Laci
Hi, Thanks for the answer. Finally I found an API for this task: http://www.tumblr.com/docs/en/api/v2#posts . It returns the required data in JSON format. Laszlo > The page isn't really that dynamic- HTTP doesn't allow for that. > Scrolling down the page triggers some Javascript. That Javascript

Re: What is the difference between "new Class()" and "Class()"?

2011-11-20 Thread Alan Gauld
On 20/11/11 21:16, Herman wrote: What is so special about the "new" operator? Assuming you mean the __new__() method? __new__() gets called when the class is being constructed, it returns the new instance. It is the real Pyhon constructor. As opposed to __init__() which is called after the

Using the Python Interpreter as a Reference

2011-11-20 Thread Travis Parks
Hello: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference. Python has a lot of similarities to my language, such as indentation for code blocks, lambdas, non-locals and my language will partially support dynamic

Re: Server Questions (2 of them)

2011-11-20 Thread Christian Heimes
Am 20.11.2011 22:44, schrieb Hrvoje Niksic: > Andrew writes: > >> How to do you create a server that accepts a set of user code? > [...] > > Look up the "exec" statement, the server can use it to execute any code > received from the client as a string. > > Note "any code", though; exec runs in

[ANNOUNCE] pypiserver 0.4.0 - minimal pypi server

2011-11-20 Thread Ralf Schmitt
Hi, I've just uploaded pypiserver 0.4.0 to the python package index. pypiserver is a minimal PyPI compatible server. It can be used to serve a set of packages and eggs to easy_install or pip. pypiserver is easy to install (i.e. just easy_install pypiserver). It doesn't have any external dependen

Re: What is the difference between "new Class()" and "Class()"?

2011-11-20 Thread Ben Finney
Herman writes: > What is so special about the "new" operator? It's special because Python doesn't have it. Can you refer us with a URL to the place where you've seen Python code containing a ‘new’ operator? -- \ “Fear him, which after he hath killed hath power to cast into | `\ hell

Re: Server Questions (2 of them)

2011-11-20 Thread Hrvoje Niksic
Andrew writes: > How to do you create a server that accepts a set of user code? [...] Look up the "exec" statement, the server can use it to execute any code received from the client as a string. Note "any code", though; exec runs in no sandbox and if a malicious client defines addition(1, 2) t

Re: What is the difference between "new Class()" and "Class()"?

2011-11-20 Thread Terry Reedy
On 11/20/2011 4:16 PM, Herman wrote: What is so special about the "new" operator? There is no 'new' operator in Python. Perhaps you are thinking of javascript or maybe jave or ...? -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Server Questions (2 of them)

2011-11-20 Thread Chris Angelico
On Mon, Nov 21, 2011 at 7:02 AM, Andrew wrote: > Hello List, > > How to do you create a server that accepts a set of user code? > > For example, > > I would like to send this function: > def addition(x,y): >   return x+y > and have the socket server perform the operation and send is back to > the

What is the difference between "new Class()" and "Class()"?

2011-11-20 Thread Herman
What is so special about the "new" operator? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to insert my own module in front of site eggs?

2011-11-20 Thread spartan.the
On Nov 18, 3:36 am, Roy Smith wrote: ... > It just seems mind-boggling to me that PYTHONPATH doesn't preempt > everything else. I was surprised too, but this issue is widespread. Best explained here: https://bugs.launchpad.net/tahoe-lafs/+bug/821000/comments/0 Quote: " The crux of the problem is

Server Questions (2 of them)

2011-11-20 Thread Andrew
Hello List, How to do you create a server that accepts a set of user code? For example, I would like to send this function: def addition(x,y): return x+y and have the socket server perform the operation and send is back to the end user. Question 2: On that same server, I want a user to be ab

python chat

2011-11-20 Thread William
Hi, I've started a new site called StudyBrunch, where we offer a chance for online studygroups with video conferencing, screen sharing etc.   I'd like to keep the groups small to be maneageble.   I will offer a basic session on python for people who are interested, on Saturday or Sunday evening

Re: scraping a tumblr.com archive page

2011-11-20 Thread Benjamin Kaplan
On Sun, Nov 20, 2011 at 1:06 PM, Jabba Laci wrote: > Hi, > > I want to extract the URLs of all the posts on a tumblr blog. Let's > take for instance this blog: http://loveyourchaos.tumblr.com/archive . > If I download this page with a script, there are only 50 posts in the > HTML. If you scroll do

scraping a tumblr.com archive page

2011-11-20 Thread Jabba Laci
Hi, I want to extract the URLs of all the posts on a tumblr blog. Let's take for instance this blog: http://loveyourchaos.tumblr.com/archive . If I download this page with a script, there are only 50 posts in the HTML. If you scroll down in your browser to the end of the archive, the browser will

Re: Is there any way to unimport a library

2011-11-20 Thread Gelonida N
I forgot to mention, that this is at the moment more a thought experiment, than a real need. On 11/20/2011 05:53 PM, Chris Angelico wrote: > On Mon, Nov 21, 2011 at 3:39 AM, Gelonida N wrote: >> No mixing would not be possible. >> >> So either I need the first two libs or the second two. >> > >

Re: Is there any way to unimport a library

2011-11-20 Thread Chris Angelico
On Mon, Nov 21, 2011 at 3:39 AM, Gelonida N wrote: > No mixing would not be possible. > > So either I need the first two libs or the second two. > I wonder, can you make the first one import the second one? That automatically defines your dependency right there, and may make things clearer - you

RE: ProgressBar - Python and Powershell

2011-11-20 Thread Nikunj.Badjatya
Thanks for reply. Python and Powershell are required because the installer would deal in virtual machines ( VMware environment ). Some prechecks and postconfig are required in both VMware and Windows environment. For dealing with VMware environment powershell has the best bonding. For windows I

Re: Is there any way to unimport a library

2011-11-20 Thread Gelonida N
Steven, Mika, Thanks for your answers. It's always good to know which options exist. It makes it easier to choose the right one depending on the situation. On 11/20/2011 04:46 PM, Steven D'Aprano wrote: > On Sun, 20 Nov 2011 16:15:05 +0100, Gelonida N wrote: > >> I wondered whether there is any

Re: Is there any way to unimport a library

2011-11-20 Thread Steven D'Aprano
On Sun, 20 Nov 2011 16:15:05 +0100, Gelonida N wrote: > I wondered whether there is any way to un-import a library, such, that > it's occupied memory and the related shared libraries are released. Not really. Python modules are objects, like everything else in Python, and can only be deleted wh

Re: Is there any way to unimport a library

2011-11-20 Thread Miki Tebeka
del sys.modules['my-module'] However if your module imported other modules, they'll still be there. If there are references to objects your module created, they'll still be there. A better option IMO is to use imp.find_module and then import. -- http://mail.python.org/mailman/listinfo/python-lis

PyGameZine launched. See http://pygame.org for details.

2011-11-20 Thread illume
Hey ya, today we launched the first issue of PyGameZine. For more info, please see the pygame website: http://www.pygame.org/ cheers! -- http://mail.python.org/mailman/listinfo/python-list

Is there any way to unimport a library

2011-11-20 Thread Gelonida N
I wondered whether there is any way to un-import a library, such, that it's occupied memory and the related shared libraries are released. My usecase is following: success = False try: import lib1_version1 as lib1 import lib2_version1 as lib2 success = True except ImportError:

Re: xml.dom.minidom question

2011-11-20 Thread Stefan Behnel
nivashno, 19.11.2011 22:32: I've got this code: >>> dom = xml.dom.minidom.parse('myfile.xml') >>> for testnode in dom.getElementsByTagName('tests')[0].childNodes: ... print testnode When it's working on this xml: something I get the following: But when it's working

Re: Announcing Mii (My) Chat

2011-11-20 Thread Joshua Miller
I have to agree with christian Mii is those avatars in the nintendo wii systemI highly recommend you change the name it might be a good idea for software but the name will most likely get you in trouble On Sun, Nov 20, 2011 at 9:17 AM, Christian Heimes wrote: > Am 20.11.2011 06:04, schrie

Re: Announcing Mii (My) Chat

2011-11-20 Thread Christian Heimes
Am 20.11.2011 06:04, schrieb Andrew Evans: > Hello I wish to inform the list of a Python Application I am writing > entitled Mii Chat. Your choice of name is most likely to cause trouble. Nintendo has a trademark on "Mii" as part of the Wii console trademark. In Nintendo's glossary a Mii is a play

Re: ProgressBar - Python and Powershell

2011-11-20 Thread Alec Taylor
Why are you writing an installer in Python and Powershell? Just write an installer in WiX, NSIS or Inno like the rest of the sane world. Alternatively take a look at MakeMSI or the script python uses to generate there .MSI. Anything else is WAY too non-standard to consider. On Mon, Nov 21, 2011

RE: ProgressBar - Python and Powershell

2011-11-20 Thread Nikunj.Badjatya
Can anyone throw some light on this please ! ? From: python-list-bounces+nikunj.badjatya=emc@python.org [mailto:python-list-bounces+nikunj.badjatya=emc@python.org] On Behalf Of nikunj.badja...@emc.com Sent: Thursday, November 17, 2011 4:10 PM To: python-list@python.org Subject: Progress

SQLObject 1.2.0

2011-11-20 Thread Oleg Broytman
Hello! I'm pleased to announce version 1.2.0, the first stable release of branch 1.2 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be eas

Re: Dynamically Generate Methods

2011-11-20 Thread GZ
Hi All, I see. It works. Thanks, GZ On Nov 18, 12:04 pm, Ian Kelly wrote: > On Fri, Nov 18, 2011 at 7:51 AM, GZ wrote: > > Hi, > > > I have a class Record and a list key_attrs that specifies the names of > > all attributes that correspond to a primary key. > > > I can write a function like thi