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

2011-11-15 Thread Passiday
Of course, I am aware of this. But the file system can be emulated, and certain networking can be mediated via the server, too. But for starts, I don't plan to go beyond the basic file operations, if at all. -- http://mail.python.org/mailman/listinfo/python-list

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

2011-11-15 Thread Passiday
Thanks Carl, this looks like a good base to start from. -- http://mail.python.org/mailman/listinfo/python-list

Got some problems when using logging Filter

2011-11-15 Thread sword
The logging cookbook gives an Filter example, explainning how to add contextural info to log. I can't figure out how to filter log from it. Suppose I have 3 file, a.py, b.py and main.py #file: a.py import logging logger=logging.getLogger(__name__) def print_log(): logger.debug("I'm module a")

Re: Stucked with python logging module

2011-11-15 Thread Kushal Kumaran
On Wed, Nov 16, 2011 at 8:58 AM, sword wrote: > I just scaned through the beginer's guide of logging module, but I > can't get anything from console. The demo just like this: > > import logging > logging.debug("This is a demo") > > Maybe I should do sth to put the log to stdout in basicConfig firs

Stucked with python logging module

2011-11-15 Thread sword
I just scaned through the beginer's guide of logging module, but I can't get anything from console. The demo just like this: import logging logging.debug("This is a demo") Maybe I should do sth to put the log to stdout in basicConfig first? Thanks in advance -- http://mail.python.org/mailman/lis

Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-15 Thread sword
Maybe you're looking for ipython? History, tab-complete, sort of things in it. goldtech wrote: > Hi, > > Using Windows. Is there a python shell that has a history of typed in > commands? > > I don't need output of commands just what I typed it. I need it to > save between sessions - something that

Re: (n00b) Tkinter trouble

2011-11-15 Thread Chris Angelico
On Wed, Nov 16, 2011 at 2:02 PM, Jason Swails wrote: > Apparently I could not do what I was wanting to (state=DISABLED is not a > valid option to Toplevel).  What I wanted to do was something similar to > what the dialogs were doing from tkMessageBox. Yes, that would be what you'd want. I wonder,

python shell that saves history of typed in commands that will persist between reboots

2011-11-15 Thread goldtech
Hi, Using Windows. Is there a python shell that has a history of typed in commands? I don't need output of commands just what I typed it. I need it to save between sessions - something that no shell seems to do. If I reboot there will still be a command history somewhere. Like bash history in Li

Re: redis beginner question

2011-11-15 Thread Roy Smith
In article , Jabba Laci wrote: > Hi, > > I'm reading the redis documentation and there is one thing that > bothers me. For redis, you need to start a server on localhost. Is > there an easy way that my Python script starts this server > automatically? Before using my script, I don't want to sta

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

2011-11-15 Thread Carl Banks
On Tuesday, November 15, 2011 12:37:03 PM UTC-8, Passiday wrote: > Hello, > > I am looking for a way how to bring Python interpreter to JavaScript, in > order to provide a web-based application with python scripting capabilities. > The app would have basic IDE for writing and debugging the pytho

Re: (n00b) Tkinter trouble

2011-11-15 Thread Jason Swails
On Tue, Nov 15, 2011 at 12:32 AM, Chris Angelico wrote: > > As a general rule, if any parent is invisible, you won't see the > child, and if any parent is disabled, you can't access the child. Yea, I'm becoming more familiar and comfortable with the GUI hierarchy as I play around. I do like ho

redis beginner question

2011-11-15 Thread Jabba Laci
Hi, I'm reading the redis documentation and there is one thing that bothers me. For redis, you need to start a server on localhost. Is there an easy way that my Python script starts this server automatically? Before using my script, I don't want to start redis-server each time. When my program ter

Re: suppressing import errors

2011-11-15 Thread David Riley
On Nov 15, 2011, at 5:59 PM, Alan Meyer wrote: > On 11/15/2011 4:20 PM, David Riley wrote: > ... >> None was set to some other value. The other value might have a type >> (such as a container) that could be false in a boolean context! >> >> Obviously, that last bit doesn't apply to m

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

2011-11-15 Thread Alan Meyer
On 11/15/2011 3:37 PM, Passiday wrote: Hello, I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, o

Re: suppressing import errors

2011-11-15 Thread Alan Meyer
On 11/15/2011 4:20 PM, David Riley wrote: ... None was set to some other value. The other value might have a type (such as a container) that could be false in a boolean context! Obviously, that last bit doesn't apply to modules; they're not going to evaluate as False in general.

Re: Extracting elements over multiple lists?

2011-11-15 Thread Chris Angelico
On Wed, Nov 16, 2011 at 9:25 AM, Steven D'Aprano wrote: > Languages aren't refcounted. Or at least, *Python* isn't a refcounted > language. CPython is a refcounted implementation. IronPython and Jython > are not. del behaves exactly the same in IronPython and Jython as it does > in CPython: it rem

Re: suppressing import errors

2011-11-15 Thread Steven D'Aprano
On Tue, 15 Nov 2011 14:22:21 -0800, Chris Kaynor wrote: > The tests (the code is shown later - its about 53 lines, with lots of > copy+paste...): Holy unnecessarily complicated code Batman! This is much simpler: [steve@ando ~]$ python -m timeit -s "x = None" "if x is None: pass" 1000 loops,

Re: Extracting elements over multiple lists?

2011-11-15 Thread Steven D'Aprano
On Wed, 16 Nov 2011 06:53:26 +1100, Chris Angelico wrote: > On Wed, Nov 16, 2011 at 5:17 AM, Dave Angel wrote: >> a = someexpression... >> b = a >> >> del a >> >> Does not (necessarily) delete the object that a refers to.  It merely >> deletes the symbol a. > > I'd have to classify that as

Re: Extracting elements over multiple lists?

2011-11-15 Thread Steven D'Aprano
On Tue, 15 Nov 2011 17:01:23 +, Prasad, Ramit wrote: > Can you expand on why 'del' is "tricky"/misleading? People often imagine that the del statement sends a message to the object "please delete yourself", which then calls the __del__ method. That is incorrect. "del x" is an unbinding ope

Re: suppressing import errors

2011-11-15 Thread Chris Kaynor
On Tue, Nov 15, 2011 at 1:34 PM, Chris Angelico wrote: > On Wed, Nov 16, 2011 at 8:20 AM, David Riley wrote: >>      Comparisons to singletons like None should always be done with >>      'is' or 'is not', never the equality operators. >> >>      Also, beware of writing "if x" when you really mea

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

2011-11-15 Thread Terry Reedy
On 11/15/2011 3:52 PM, Ian Kelly wrote: On Tue, Nov 15, 2011 at 1:37 PM, Passiday wrote: Hello, I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and d

Re: suppressing import errors

2011-11-15 Thread Ian Kelly
On Tue, Nov 15, 2011 at 2:42 PM, Arnaud Delobelle wrote: > It's idiomatic to write "x is None" when you want to know whether x is None. It's also idiomatic to just write "if x:" when you want to know whether x is something or nothing, and that's what I would probably do here. Either is correct.

Re: suppressing import errors

2011-11-15 Thread Arnaud Delobelle
On 15 November 2011 21:34, Chris Angelico wrote: > On Wed, Nov 16, 2011 at 8:20 AM, David Riley wrote: >>      Comparisons to singletons like None should always be done with >>      'is' or 'is not', never the equality operators. >> >>      Also, beware of writing "if x" when you really mean "if

Re: suppressing import errors

2011-11-15 Thread Chris Angelico
On Wed, Nov 16, 2011 at 8:20 AM, David Riley wrote: >    Comparisons to singletons like None should always be done with >      'is' or 'is not', never the equality operators. > >      Also, beware of writing "if x" when you really mean "if x is not None" >      -- e.g. when testing whether a var

Re: suppressing import errors

2011-11-15 Thread David Riley
On Nov 15, 2011, at 3:01 PM, Chris Angelico wrote: > On Wed, Nov 16, 2011 at 6:39 AM, David Riley wrote: >> True, and that does avoid polluting namespace. However, you shouldn't be >> testing for None as a bool; you should instead do an "if is None:" >> (or, of course, "is not None"). > > Wh

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

2011-11-15 Thread Stef Mientki
On 15-11-2011 21:37, Passiday wrote: Hello, I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of

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

2011-11-15 Thread Ian Kelly
On Tue, Nov 15, 2011 at 1:37 PM, Passiday wrote: > Hello, > > I am looking for a way how to bring Python interpreter to JavaScript, in > order to provide a web-based application with python scripting capabilities. > The app would have basic IDE for writing and debugging the python code, but > t

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

2011-11-15 Thread Passiday
Hello, I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'

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

2011-11-15 Thread Chris Angelico
On Wed, Nov 16, 2011 at 7:37 AM, Passiday wrote: > The app would have basic IDE for writing and debugging the python code, but > the interpretation, of course, would be done in JavaScript. I'd like to avoid > any client-server transactions, so all the interpretation should take place > on the c

Re: suppressing import errors

2011-11-15 Thread Chris Angelico
On Wed, Nov 16, 2011 at 6:39 AM, David Riley wrote: > True, and that does avoid polluting namespace.  However, you shouldn't be > testing for None as a bool; you should instead do an "if is None:" > (or, of course, "is not None"). Why not? Is there some other way for the module object to evalu

Re: Extracting elements over multiple lists?

2011-11-15 Thread Chris Angelico
On Wed, Nov 16, 2011 at 5:17 AM, Dave Angel wrote: > a = someexpression... > b = a > > del a > > Does not (necessarily) delete the object that a refers to.  It merely > deletes the symbol a. I'd have to classify that as part of the change of thinking necessary for a refcounted language, and

Re: suppressing import errors

2011-11-15 Thread David Riley
On Nov 15, 2011, at 1:58 PM, Jean-Michel Pichavant wrote: > PS : @Dave there is a way to avoiding adding symbols to your global > namespace, assign None to the module's name on import errors. Then before > using it, just test the module bool value : if serial: serial.whateverMethod() True, and

Wing IDE 4.1.1 released

2011-11-15 Thread Wingware
Hi, Wingware has released version 4.1.1 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call tip

Gossip Protocol in Python

2011-11-15 Thread alisha alisha
Hi All, I am new to Python. I have to implement a overlay network of around 500 nodes which are arranged as a random graph. To generate theoverlay network I will be using networkx. My query is, is there a way to implement Gossip protocol in my overlay network using Python. Like one node initiated

Re: suppressing import errors

2011-11-15 Thread Jean-Michel Pichavant
David Riley wrote: On Nov 15, 2011, at 12:35 PM, Andreea Babiuc wrote: On 15 November 2011 17:24, Chris Kaynor wrote: As with any Python code, you can wrap the import into a try: except block. try: import badModule except: pass # Or otherwise handle the exception - possibly importing

Re: overview on dao

2011-11-15 Thread MRAB
On 15/11/2011 17:26, Prasad, Ramit wrote: Perhaps you should call it "LaoZiDao". I just prefer shorter name. DAO as Data Access Objects is a common acronym in several languages (i.e. Java), so you will continually have this naming conflict. Just be aware that this conflict will happen frequent

Re: Extracting elements over multiple lists?

2011-11-15 Thread Dave Angel
On 11/15/2011 12:01 PM, Prasad, Ramit wrote: (Peter's "del" solution is quite close, but I find the 'del' statement tricky in python and will mislead many python newcomers) Can you expand on why 'del' is "tricky"/misleading? Ramit a = someexpression... b = a del a Does not (necessaril

Re: suppressing import errors

2011-11-15 Thread David Riley
On Nov 15, 2011, at 12:35 PM, Andreea Babiuc wrote: > > > On 15 November 2011 17:24, Chris Kaynor wrote: > As with any Python code, you can wrap the import into a try: except block. > > try: > import badModule > except: > > > pass # Or otherwise handle the exception - possibly importing a

Re: suppressing import errors

2011-11-15 Thread Andreea Babiuc
On 15 November 2011 17:24, Chris Kaynor wrote: > As with any Python code, you can wrap the import into a try: except block. > > try: > import badModule > except: > > pass # Or otherwise handle the exception - possibly importing an > alternative module. > > Hmm, I know this might sound silly,

RE: overview on dao

2011-11-15 Thread Prasad, Ramit
>> Perhaps you should call it "LaoZiDao". >I just prefer shorter name. DAO as Data Access Objects is a common acronym in several languages (i.e. Java), so you will continually have this naming conflict. Just be aware that this conflict will happen frequently in the minds of many programmers. Ra

Re: suppressing import errors

2011-11-15 Thread Chris Kaynor
As with any Python code, you can wrap the import into a try: except block. try: import badModule except: pass # Or otherwise handle the exception - possibly importing an alternative module. As with any except statement, specific exceptions may be caught (rather than the blank, catch everything)

suppressing import errors

2011-11-15 Thread Andreea Babiuc
Hi, Is there a way to suppress all the errors when importing a module in python? By that I mean.. If I have other imports in the module I'm trying to import that fail, I still want my module to be imported that way.. Many thanks. -- http://mail.python.org/mailman/listinfo/python-list

RE: Extracting elements over multiple lists?

2011-11-15 Thread Prasad, Ramit
>>for x in a, b, c: >>del x[0] >for arr in [a,b,c]: > arr.pop(0) >(Peter's "del" solution is quite close, but I find the 'del' statement >tricky in python and will mislead many python newcomers) Can you expand on why 'del' is "tricky"/misleading? Ramit Ramit Prasad | JPMorgan Chase Inves

Re: all() is slow?

2011-11-15 Thread BOOK-AZ
On Nov 7, 1:00 pm, "OKB (not okblacke)" wrote: >         I noticed this (Python 2.6.5 on Windows XP): > http://book-az.com > >>> import random, timeit > >>> def myAll(x): > > ...     for a in x: > ...         if a not in (True, False): > ...             return False > ...     return True>>> x = [r

Re: Execute a command on remote machine in python

2011-11-15 Thread Rodrick Brown
You could easily script this with popen calling secure shell to execute a command and capture the output. Sent from my iPhone On Nov 15, 2011, at 7:04 AM, Roark wrote: > Hi, > > I am first time trying my hands on python scripting and would need > some guidance from the experts on my problem

Re: PREFIX directory for pip command

2011-11-15 Thread Makoto Kuwata
On Tue, Nov 15, 2011 at 11:33 PM, Marc Christiansen wrote: > > I'd try >  export PIP_INSTALL_OPTION=--prefix=$PWD/local It works very well. Thank you. -- regards, makoto > > using a config file is also possible. See > http://www.pip-installer.org/en/latest/configuration.html > > Ciao > Marc > -

Re: Execute a command on remote machine in python

2011-11-15 Thread Marco Nawijn
On Nov 15, 1:04 pm, Roark wrote: > Hi, > > I am first time trying my hands on python scripting and would need > some guidance from the experts on my problem. > > I want to execute a windows command within python script from a client > machine on a remote target server, and would want the output of

Re: else in try/except

2011-11-15 Thread Robert Kern
On 11/15/11 2:31 PM, Grant Edwards wrote: On 2011-11-15, Barry W Brown wrote: I thought that the point of the else clause is that it is reached only if there is no exception in the try clause. Not really. If that's all you wanted, then you just put the code at the end of the try block. No

Re: PREFIX directory for pip command

2011-11-15 Thread Marc Christiansen
Makoto Kuwata wrote: > Is it possible to specify PREFIX directory for pip command by > environment variable? > > I found that 'pip install --install-option=--prefix=PREFIX' works well, > but I don't want to specify '--install-option=--prefix=PREFIX' every time. > I prefer to specify it by environ

Re: else in try/except

2011-11-15 Thread Grant Edwards
On 2011-11-15, Barry W Brown wrote: > I thought that the point of the else clause is that it is reached > only if there is no exception in the try clause. Not really. If that's all you wanted, then you just put the code at the end of the try block. -- Grant Edwards grant.b.edwar

Re: Execute a command on remote machine in python

2011-11-15 Thread Roy Smith
In article , Chris Angelico wrote: > On Tue, Nov 15, 2011 at 11:04 PM, Roark wrote: > > Hi, > > > > I want to execute a windows command within python script from a client > > machine on a remote target server, and would want the output of the > > command written in a file on client machine. Wha

Re: Execute a command on remote machine in python

2011-11-15 Thread Xavier Ho
It sounds like Fabric is what you're after. We use it at work and it's the best thing since ssh. ;] http://docs.fabfile.org/en/1.3.2/index.html (Actually, it uses ssh internally and allows you to do remote shell-like programming in a pythonic fashion.) Cheers, Xav On 15 November 2011 22:04, R

Re: Execute a command on remote machine in python

2011-11-15 Thread Chris Angelico
On Tue, Nov 15, 2011 at 11:04 PM, Roark wrote: > Hi, > > I want to execute a windows command within python script from a client > machine on a remote target server, and would want the output of the > command written in a file on client machine. What is the way it could > be achieved. This looks l

Re: Execute a command on remote machine in python

2011-11-15 Thread Jean-Michel Pichavant
Martin P. Hellwig wrote: On 11/15/11 12:04, Roark wrote: Hi, I am first time trying my hands on python scripting and would need some guidance from the experts on my problem. I want to execute a windows command within python script from a client machine on a remote target server, and would want

PREFIX directory for pip command

2011-11-15 Thread Makoto Kuwata
Is it possible to specify PREFIX directory for pip command by environment variable? I found that 'pip install --install-option=--prefix=PREFIX' works well, but I don't want to specify '--install-option=--prefix=PREFIX' every time. I prefer to specify it by environment variable such as:: expor

Re: Execute a command on remote machine in python

2011-11-15 Thread Martin P. Hellwig
On 11/15/11 12:04, Roark wrote: Hi, I am first time trying my hands on python scripting and would need some guidance from the experts on my problem. I want to execute a windows command within python script from a client machine on a remote target server, and would want the output of the command

Execute a command on remote machine in python

2011-11-15 Thread Roark
Hi, I am first time trying my hands on python scripting and would need some guidance from the experts on my problem. I want to execute a windows command within python script from a client machine on a remote target server, and would want the output of the command written in a file on client machi

Re: Opportunity missed by Python ?

2011-11-15 Thread Jack Keegan
On Thu, Oct 13, 2011 at 11:07 AM, Chris Angelico wrote: > On Thu, Oct 13, 2011 at 8:45 PM, candide wrote: > > Dart is the very new language created by Google to replace Javascript. > > So Python was not able to do the job? Or may be they don't know about > Python > > at Google ;) ? > > > > Also,