Sunday, February 28, 2010

comp.lang.python - 25 new messages in 17 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Challenge: escape from the pysandbox - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/87bf10f8acede7c3?hl=en
* Py2exe - Bad File Descriptor - 4 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/da53bce38fcf95b6?hl=en
* Updates about Tk - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/d8d24eacf022ed75?hl=en
* stripping fields from xml file into a csv - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/978963344b473e2d?hl=en
* Upgrading Py2exe App - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/425fea70d75ab788?hl=en
* Python dos2unix one liner - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/c4b63debe91d51c7?hl=en
* PyQt4.7 and PyQwt5.2.0 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/8e2afe83fd158f42?hl=en
* pynguin-0.1 (python-based turtle graphics application) - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/e5ff8666aba21846?hl=en
* Earn Money Online without Investment - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/2abdd714493399d1?hl=en
* Docstrings considered too complicated - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/dea5c94f3d058e26?hl=en
* help with Python installation - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/7b9dfd6f69a57931?hl=en
* Quoting quotes - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/91b44580c41be61c?hl=en
* Use eval() safely? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/885bc48dabf073e6?hl=en
* cpan for python? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ecd51ced8d24593e?hl=en
* Starting Python from the terminal with no welcome message - 2 messages, 2
authors
http://groups.google.com/group/comp.lang.python/t/e7843b8d59f2e41a?hl=en
* Sample code usable Tkinter listbox - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/bd27ec170800827f?hl=en
* Draft PEP on RSON configuration file format - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/09ce33197b330e90?hl=en

==============================================================================
TOPIC: Challenge: escape from the pysandbox
http://groups.google.com/group/comp.lang.python/t/87bf10f8acede7c3?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Feb 28 2010 9:55 am
From: aahz@pythoncraft.com (Aahz)


In article <mailman.330.1267292249.4577.python-list@python.org>,
Daniel Fetchinson <fetchinson@googlemail.com> wrote:
>
>I guess they also have some kind of a sandbox if they let people run
>python on their machines, I'm not sure if it's open source though.

Thing is, I'm sure that Google uses a critical backstop to any
Python-based sandbox: something like a chroot jail. The Python sandbox
is mostly there to inform you about what you can and can't do; the real
security is provided by the OS.
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer


== 2 of 2 ==
Date: Sun, Feb 28 2010 2:40 pm
From: Daniel Fetchinson


>>I guess they also have some kind of a sandbox if they let people run
>>python on their machines, I'm not sure if it's open source though.
>
> Thing is, I'm sure that Google uses a critical backstop to any
> Python-based sandbox: something like a chroot jail. The Python sandbox
> is mostly there to inform you about what you can and can't do; the real
> security is provided by the OS.

I see, makes perfect sense. This then raises the question whether it's
important to have a 100% fool proof python sandbox without help from
the OS, or this goal is not only too ambitious but also not really a
useful one. One aspect might be that one might want to have a platform
independent way of sandboxing, perhaps.

Cheers,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown

==============================================================================
TOPIC: Py2exe - Bad File Descriptor
http://groups.google.com/group/comp.lang.python/t/da53bce38fcf95b6?hl=en
==============================================================================

== 1 of 4 ==
Date: Sun, Feb 28 2010 10:35 am
From: T


I have a Python script, which is a Windows Service, that I created an
EXE of via py2exe. As part of the program, it calls some external
binaries, one of which restarts the computer. When I'm logged in,
this works fine. However, if I log out, the service stops and logs
the following error in the Event Log:

<type 'exceptions.IOError'>:(9, 'Bad file descriptor')

Anyone have an idea what could be causing this?


== 2 of 4 ==
Date: Sun, Feb 28 2010 12:48 pm
From: Dennis Lee Bieber


On Sun, 28 Feb 2010 10:35:23 -0800 (PST), T <misceverything@gmail.com>
declaimed the following in gmane.comp.python.general:

> I have a Python script, which is a Windows Service, that I created an
> EXE of via py2exe. As part of the program, it calls some external
> binaries, one of which restarts the computer. When I'm logged in,
> this works fine. However, if I log out, the service stops and logs
> the following error in the Event Log:
>
> <type 'exceptions.IOError'>:(9, 'Bad file descriptor')
>
> Anyone have an idea what could be causing this?

Without code, one must play psychic... And I haven't dusted off the
Tarot cards, I Ching coins, and Crystal balls is some time (No, I don't
have a ouija board)...

Could it be you have a mapped drive that gets disconnected when you
log off?

Is the service being started as part of your login?

Does it attempt to write to a console?
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

== 3 of 4 ==
Date: Sun, Feb 28 2010 1:22 pm
From: T


On Feb 28, 3:48 pm, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> On Sun, 28 Feb 2010 10:35:23 -0800 (PST), T <misceveryth...@gmail.com>
> declaimed the following in gmane.comp.python.general:
>
> > I have a Python script, which is a Windows Service, that I created an
> > EXE of via py2exe.  As part of the program, it calls some external
> > binaries, one of which restarts the computer.  When I'm logged in,
> > this works fine.  However, if I log out, the service stops and logs
> > the following error in the Event Log:
>
> > <type 'exceptions.IOError'>:(9, 'Bad file descriptor')
>
> > Anyone have an idea what could be causing this?
>
>         Without code, one must play psychic... And I haven't dusted off the
> Tarot cards, I Ching coins, and Crystal balls is some time (No, I don't
> have a ouija board)...
>
>         Could it be you have a mapped drive that gets disconnected when you
> log off?
>
>         Is the service being started as part of your login?
>
>         Does it attempt to write to a console?
> --
>         Wulfraed         Dennis Lee Bieber               KD6MOG
>         wlfr...@ix.netcom.com      HTTP://wlfraed.home.netcom.com/

Sorry for the lack of code - yes, it does try to write to the
console. From what I'm finding, this error may be due to the fact
that there is no "console" to write to when I'm logged off. However,
I would like to be able to print to screen if I run the EXE in debug
mode (i.e. "myservice.exe debug"). Do you know of any way around
this? Also, I need to get the output generated from an external EXE -
will subprocess.Popen cause problems if I use stdout=PIPE? Thanks for
your help!


== 4 of 4 ==
Date: Sun, Feb 28 2010 7:00 pm
From: Dennis Lee Bieber


On Sun, 28 Feb 2010 13:22:19 -0800 (PST), T <misceverything@gmail.com>
declaimed the following in gmane.comp.python.general:

> Sorry for the lack of code - yes, it does try to write to the
> console. From what I'm finding, this error may be due to the fact
> that there is no "console" to write to when I'm logged off. However,
> I would like to be able to print to screen if I run the EXE in debug
> mode (i.e. "myservice.exe debug"). Do you know of any way around
> this? Also, I need to get the output generated from an external EXE -
> will subprocess.Popen cause problems if I use stdout=PIPE? Thanks for
> your help!

True services typically don't have interactive (console) type I/O...
What is more likely to work is to have an open socket waiting for
connections, and the use of a separate user-space client that connects
to the socket...
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/


==============================================================================
TOPIC: Updates about Tk
http://groups.google.com/group/comp.lang.python/t/d8d24eacf022ed75?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 11:10 am
From: Fabiano


rantingrick ha scritto:
> On Feb 27, 11:11 am, Kevin Walzer <k...@codebykevin.com> wrote:
>
> (...snip...)
>
>> Kevin Walzer
>> Code by Kevinhttp://www.codebykevin.com
>
> Great post Kevin! The only thing i would like to add are my two
> favorite references for learning Tkinter. They are not geared around
> the new ttk stuff, but still 95% relevant to any Tkinter-ing
>
> http://effbot.org/tkinterbook/
> http://infohost.nmt.edu/tcc/help/pubs/tkinter/
>
>

Thanks @All you guys for the explanations and links!
Regards

==============================================================================
TOPIC: stripping fields from xml file into a csv
http://groups.google.com/group/comp.lang.python/t/978963344b473e2d?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Feb 28 2010 11:20 am
From: Stefan Behnel


Hai Vu, 28.02.2010 17:41:
> By the way, Stefan, I am using Python 2.6. Do you know the differences
> between ElementTree and cElementTree?

Use cElementTree, it's implemented in C and a lot faster and more memory
friendly.

http://effbot.org/zone/celementtree.htm#benchmarks
http://codespeak.net/lxml/performance.html

Stefan

== 2 of 2 ==
Date: Sun, Feb 28 2010 3:15 pm
From: Hal Styli


On 28 Feb, 19:20, Stefan Behnel <stefan...@behnel.de> wrote:
> Hai Vu, 28.02.2010 17:41:
>
> > By the way, Stefan, I am using Python 2.6. Do you know the differences
> > between ElementTree and cElementTree?
>
> Use cElementTree, it's implemented in C and a lot faster and more memory
> friendly.
>
> http://effbot.org/zone/celementtree.htm#benchmarkshttp://codespeak.net/lxml/performance.html
>
> Stefan

Thanks for the responses so far, most enlightening.

Stefan, I was happy to see such concise code.
Your python worked with only very minor modifications.

Hai's test xml data *without* the first and last line is close enough
to the data I am using:

<order customer="john" product="eggs" quantity="12" />
<order customer="cindy" product="bread" quantity="1" />
<order customer="larry" product="tea bags" quantity="100" />
<order customer="john" product="butter" quantity="1" />
<order product="chicken" quantity="2" customer="derek" />

... quirky.

I get a large file given to me in this format. I believe it is
created by something like:
grep 'customer=' *.xml, where there are a large number of xml files.

I had to edit the data to include the first and last lines, <orders>
and </orders>,
to get the python code to work. It's not an arduous task(!), but can
you recommend a way to get it to work without
manually editing the data?

One other thing, what's the Roland Mueller post above about (I'm
viewing htis in google groups)? What would the test.xsl file look
like?

Thanks again

Hal.

==============================================================================
TOPIC: Upgrading Py2exe App
http://groups.google.com/group/comp.lang.python/t/425fea70d75ab788?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 11:44 am
From: aahz@pythoncraft.com (Aahz)


In article <mailman.201.1267054217.4577.python-list@python.org>,
Ryan Kelly <ryan@rfk.id.au> wrote:
>On Wed, 2010-02-24 at 15:05 -0800, Aahz wrote:
>> In article <mailman.2807.1266614926.28905.python-list@python.org>,
>> Ryan Kelly <ryan@rfk.id.au> wrote:
>>>
>>>Yes. The idea of having a "bootstrapping exe" is that actual
>>>application code can be swapped out without having to overwrite the
>>>executable file. As long as you don't change python versions, this
>>>allows updates to be safe against system crashes, even on platforms
>>>without atomic file replacement.
>>>
>>>So the frozen app does this in a background thread:
>>>
>>> Esky(sys.executable,"http://my.updates.com").auto_update()
>>>
>>>And it hits the given url, grabs the latest zipfile, downloads and
>>>unpacks and atomically places it into the application directory. Et
>>>viola, your app is at the latest version.
>>
>> How does this work with a running app? What if the app is a service?
>
>The changes will only take effect the next time the app is started -
>currently there's no support for "hot upgrading" a running app.

From my POV, hot upgrading is less important than solid restart
capabilities, particularly for services. Performing tasks like modifying
the DB schema is also important (not the actual capability, but hooks for
it). E.g., the next time the app starts, it should know that it's been
upgraded.
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer

==============================================================================
TOPIC: Python dos2unix one liner
http://groups.google.com/group/comp.lang.python/t/c4b63debe91d51c7?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Feb 28 2010 12:48 pm
From: Dennis Lee Bieber


On Sun, 28 Feb 2010 12:05:12 +0100, Stefan Behnel <stefan_ml@behnel.de>
declaimed the following in gmane.comp.python.general:

> Steven D'Aprano, 28.02.2010 09:48:
> > There ought to be some kind of competition for the least efficient
> > solution to programming problems
>
> That wouldn't be very interesting. You could just write a code generator
> that spits out tons of garbage code including a line that solves the
> problem, and then let it execute the code afterwards. That beast would
> always win.
>
This is beginning to sound like the final project someone did at my
college (he was a year ahead of me, and this is hearsay); supposedly he
couldn't figure out how to write the code for the solution but since the
instructor had given the test data and the correct results he'd created
some ugly spaghetti coded (we are talking late 70s here -- flow charts
were still considered coding tools) that somewhere read the input, and
after lots of obscure operations, had output statements that gave out
the canned result.
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

== 2 of 2 ==
Date: Sun, Feb 28 2010 2:59 pm
From: Steven D'Aprano


On Sun, 28 Feb 2010 12:05:12 +0100, Stefan Behnel wrote:

> Steven D'Aprano, 28.02.2010 09:48:
>> There ought to be some kind of competition for the least efficient
>> solution to programming problems
>
> That wouldn't be very interesting. You could just write a code generator
> that spits out tons of garbage code including a line that solves the
> problem, and then let it execute the code afterwards. That beast would
> always win.

Obfuscated code competitions could do the same: insert your simple,
straight-forward, completely unobfuscated algorithm somewhere in the
middle of 15 GB of garbage code. Who would even find it?

But they don't, because human judges decide the winner, not some silly
rule of "the most lines of code wins".

In any case, I wasn't serious. It would be a bit of fun, if you like that
sort of thing, and you might even learn a few things (I never knew that
ints don't have an __eq__ method), but I can't see it taking off. I
prefer to use my powers for inefficiency to be sarcastic to strangers on
Usenet.

--
Steven

==============================================================================
TOPIC: PyQt4.7 and PyQwt5.2.0
http://groups.google.com/group/comp.lang.python/t/8e2afe83fd158f42?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 1:15 pm
From: Gib Bogle


I installed the latest PyQt (4.7-1), then PyQwt 5.2.0, which was built with
PyQt4.5.4. This line

import PyQt4.Qwt5 as Qwt

fails to load the DLL. Could this be the result of not using PyQt4 4.5.4?

==============================================================================
TOPIC: pynguin-0.1 (python-based turtle graphics application)
http://groups.google.com/group/comp.lang.python/t/e5ff8666aba21846?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 1:17 pm
From: Lee Harr

pynguin is a python-based turtle graphics application.
    It combines an editor, interactive interpreter, and
    graphics display area.

It is meant to be an easy environment for introducing
    some programming concepts to beginning programmers.


http://pynguin.googlecode.com/


This is the initial release, with many optimizations
    and finer details yet to come. Please check it out
    and let me know what you think.


pynguin is tested with Python 2.6.4 and uses PyQt (4.6)
    for its GUI elements. pynguin is released under GPLv3.


Changes in pynguin-0.1:
    - initial public release


_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969

==============================================================================
TOPIC: Earn Money Online without Investment
http://groups.google.com/group/comp.lang.python/t/2abdd714493399d1?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 1:47 pm
From: "ranga..............."


Earn Money Online without Investment

Now anyone can earn money online with out any investment by using some
genuine websites.
The detailed information of some of the genuine everseen good earnings
website information are presented clealy for free at

http://earnmoneyonline-without-investment.blogspot.com/2010/02/earn-money-with-e-mail-marketing-how-it.html

Earn Money Online with out Inevstment Overview :

| Home |
| E-mail Marketing |
| Home Job Opportunities |
| Contact |
| Disclaimer |
| Sitemap |

Earn Money By :

| Reading E-mails |
| Clicking Ads |
| Chatting Friends |
| Surfing Internet |
| Filling Forms |
| Taking Surveys |

==============================================================================
TOPIC: Docstrings considered too complicated
http://groups.google.com/group/comp.lang.python/t/dea5c94f3d058e26?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 2:10 pm
From: aahz@pythoncraft.com (Aahz)


In article <4b889e3d$0$27844$c3e8da3@news.astraweb.com>,
Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au> wrote:
>On Fri, 26 Feb 2010 21:51:17 -0600, Tim Daneliuk wrote:
>>
>> The only possible exception to this I can think of is when there is some
>> non-obvious side-effect (i.e. language and/or hardware is
>> "misfeatured"):
>>
>> mov A,B ; Moving A into B also will also arm
>> ; the nuclear warhead if the CPU is
>> ; hotter than 110C
>
>I had an embedded device that did *just that*, but only on Tuesdays.

Thus explaining why some people never can get the hang of Tuesdays.
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer

==============================================================================
TOPIC: help with Python installation
http://groups.google.com/group/comp.lang.python/t/7b9dfd6f69a57931?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 2:23 pm
From: gujax


On Feb 27, 10:14 pm, Arnaud Delobelle <arno...@googlemail.com> wrote:
> On 28 Feb, 01:48, gujax <rjngrj2...@gmail.com> wrote:
>
> > Hi,
> > I have been trying to install python on my Win ME system for over two
> > years - gave up for a while and now I am back with a resolve to solve
> > the problem. I tried all versions of python but having installation
> > problems for all. Installation does not proceed and I get a message
> > saying "dll required for installation could not be run". I do not even
> > know what to do next. I also tried Activepython. It installs but when
> > I try to open it from Start->Programs->ActivePython 2.6, I get an
> > error window saying - upgrade windows.
> > Is there no solution at all to installing python on WinME. I have
> > checked registry several times online and have sought professional
> > help but so far no success.
> > Thanks, I will appreciate any help
> > gujax
>
> The docs (*) say that Python 2.5 is still compatible with Windows 9X
> and ME, but that support for these platform was dropped at 2.6.  So
> you should be able to install and run Python 2.5.
>
> (*)http://docs.python.org/using/windows.html#installing-python
>
> --
> Arnaud

Hi,
Yes indeed, Python 2.5 worked and so did numpy and scipy for this
version. Thanks to all for your inputs. There are now issues with
plotting - graph plotting using pylab does not work nor does the Tck-
Tk, but for now I am satisfied. Hopefully I will plod my way through.
I should have read the documentation properly to realize that Win ME
is not supported for later versions,
Thanks again
Gujax

==============================================================================
TOPIC: Quoting quotes
http://groups.google.com/group/comp.lang.python/t/91b44580c41be61c?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 2:46 pm
From: candide


OK, now I see the point. I was mistaken because I was supposing that
every quote strictly _inside_ the string have to match another quote od
the same type.

Thanks to all for yours responses.

==============================================================================
TOPIC: Use eval() safely?
http://groups.google.com/group/comp.lang.python/t/885bc48dabf073e6?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 2:52 pm
From: "W. Martin Borgert"


Gregory Ewing wrote:
> I posted a demonstration of this earlier in this thread.

As you wrote, your example does not work when using eval() like
in my original post with second and third parameter to eval():

>>> import math
>>> eval("[c for c in (0).__class__.__bases__[0].__subclasses__() if c.__name__ == 'file'][0]('/myfile', 'w')",
{ "__builtins__": None }, { "abs": abs, "sin": math.sin })
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
IOError: file() constructor not accessible in restricted mode

(Same result with Python 2.4, 2.5, and 2.6.)

While I believe, that eval() is not save, I have yet to see an
example for exploiting it. Leaving out the second and third
parameter just proves, that one shouldn't omit them :~)

Thanks in advance for any black hat example!

P.S. Please Cc me, thanks.

==============================================================================
TOPIC: cpan for python?
http://groups.google.com/group/comp.lang.python/t/ecd51ced8d24593e?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 2:57 pm
From: Steven D'Aprano


On Sun, 28 Feb 2010 17:27:22 +0100, Daniel Fetchinson wrote:

> <OFF>
> Is it only me or others also mentally read C-SPAN when somebody writes
> CPAN? </OFF>

No, it's not just you. This is the first time I've realised it wasn't
C-SPAN.


--
Steven

==============================================================================
TOPIC: Starting Python from the terminal with no welcome message
http://groups.google.com/group/comp.lang.python/t/e7843b8d59f2e41a?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Feb 28 2010 3:23 pm
From: candide


Hi,

Does exist some option I could send to the python interpreter during an
interactive session in order to avoid the printing of the introductory
message just above the top prompt ?

In my case, the welcome message is the following :

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

gdb has such an option (the so-called quiet option).


Compare this :

$ gdb
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
(gdb)

with that

$ gdb -q
(gdb)


== 2 of 2 ==
Date: Sun, Feb 28 2010 5:21 pm
From: Tim Chase


candide wrote:
> Does exist some option I could send to the python interpreter during an
> interactive session in order to avoid the printing of the introductory
> message just above the top prompt ?
>
> In my case, the welcome message is the following :
>
> Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.

I asked a similar question a while back:

http://www.opensubscriber.com/message/python-list@python.org/4611139.html

(strangely, I couldn't find that in the mail.python.org archives
via google)

If you don't want to monkey with the prompts (like I did in that
thread), you can just use

bash$ python -ic ""

to get a python shell without the banner.

That said, it _would_ be a nice addition to have a "-q"uiet
startup option that behaves like many other apps do. But with it
being just a few extra characters on the command-line, I don't
expect it will happen.

-tkc

==============================================================================
TOPIC: Sample code usable Tkinter listbox
http://groups.google.com/group/comp.lang.python/t/bd27ec170800827f?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Feb 28 2010 4:30 pm
From: "Alf P. Steinbach"


In case Someone Else(TM) may need this.

This code is just how it currently looks, what I needed for my code, so it's not
a full-fledged or even tested class.

But it works.


<code language="Py3">
import tkinter as t
import tkinter.simpledialog
import tkinter.messagebox
t.askstring = tkinter.simpledialog.askstring
t.warningbox = tkinter.messagebox.showwarning

class UsableListbox( t.Frame ):
def __init__( self, parent_widget ):
t.Frame.__init__( self, parent_widget )
scrollbar = t.Scrollbar( self, orient = "vertical" )
self.lb = t.Listbox( self, yscrollcommand = scrollbar.set )
scrollbar.config( command = self.lb.yview )
scrollbar.pack( side = "right", fill = "y" )
self.lb.pack( side = "left", fill = "both", expand = 1 )

def current_index( self ):
indices = self.lb.curselection()
assert( len( indices ) <= 1 ) # TODO: about multi-selection.
return None if len( indices ) == 0 else int( indices[0] )

def current( self ):
#return self.lb.get( "active" ) # Incorrect with mousing
i = self.current_index()
return "" if i is None else self.lb.get( i )

def append( self, item ):
return self.lb.insert( "end", item )

def add_selection_event_handler( self, handler ):
"An event handler takes one argument, a Tkinter Event"
return self.lb.bind( "<<ListboxSelect>>", handler )
</code>


Cheers,

- Alf

==============================================================================
TOPIC: Draft PEP on RSON configuration file format
http://groups.google.com/group/comp.lang.python/t/09ce33197b330e90?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Feb 28 2010 6:09 pm
From: Patrick Maupin


All:

Finding .ini configuration files too limiting, JSON and XML to hard to
manually edit, and YAML too complex to parse quickly, I have started
work on a new configuration file parser.

I call the new format RSON (for "Readable Serial Object Notation"),
and it is designed to be a superset of JSON.

I would love for it to be considered valuable enough to be a part of
the standard library, but even if that does not come to pass, I would
be very interested in feedback to help me polish the specification,
and then possibly help for implementation and testing.

The documentation is in rst PEP form, at:

http://rson.googlecode.com/svn/trunk/doc/draftpep.txt

Thanks and best regards,
Pat


== 2 of 2 ==
Date: Sun, Feb 28 2010 6:55 pm
From: Paul Rubin


Patrick Maupin <pmaupin@gmail.com> writes:
> I have started work on a new configuration file parser....
> The documentation is in rst PEP form, at:...

Noooooooo.... not another... there are too many already. :-(

-1


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate