GOZERBOT 0.9.2 BETA1 released

2010-04-26 Thread Bart Thate
I just released the first BETA of GOZERBOT version 0.9.2

Please test this release if you can.

Best is to run of the mercurial repo:

hg clone http://core.gozerbot.org/hg/dev/0.9

or run easy_install -U gozerbot gozerplugs (make sure there is no
gozerbot dir in your working directory.)

docs are at http://gozerbot.org/0.9.2

If you find any bugs you can report them at http://dev,gozerbot.org/

Have fun !

about GOZERBOT:

GOZERBOT is a channel bot that aids with conversation in irc channels
and jabber conference rooms. its mainly used to send notifications
(RSS, nagios, etc.) and to have custom commands made for the channel.
More then just a channel bot GOZERBOT aims to provide a platform for
the user to program his own bot and make it into something thats
usefull. This is done with a plugin structure that makes it easy to
program your own plugins. But GOZERBOT comes with some batteries
included, there are now over 100 plugins already written and ready for
use.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


ANN: expy 0.6.4 released!

2010-04-26 Thread Yingjie Lan
expy is an express way to extend python.

I have been using this in a big project and the outcome is quite satisfying.

What's New:  

1. now generated header files are separate from implementation files.
2. bug fixes.
3. updated documentation.

For more information: http://expy.sourceforge.net/

Cheers,

Yingjie


  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Terry Reedy

On 4/25/2010 11:36 PM, Keith wrote:

I am considering writing a PEP for the inclusion of an engineering
format specifier, and would appreciate input from others.


I tested that input is no problem, so the only question is output.


Do you think this idea has enough merit to make it to PEP status?


I think it has enough merit to be considered. A minor addition to 
.format() specifiers for 3.whenever would probably not require a PEP. 
(It is too late at night for me to think about anything concrete at the 
moment, though.) A concrete proposal on the python-ideas list might be 
enough. I am not sure if this would be covered by the current moratorium 
on core changes, though.


Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe breaking wxPython?

2010-04-26 Thread Nick Ballard
On Apr 24, 6:53 pm, Alex Hall mehg...@gmail.com wrote:
 Hello all,
 I have a compiled version of my project, but the wx functions do not
 work. When run from the python source, instead of the compiled .exe
 file, wx works as expected. I am including msvcr90.dll in the dist
 folder. I looked for answers on Google, but I could not really follow
 the tutorials and forums I found. Is there a simple fix for this? BTW,
 I am still using py2exe and python2.6. Here is the traceback I get
 when using the .exe version of the project and calling a wx operation:

 Traceback (most recent call last):
   File sw.pyw, line 217, in module
   File dict.pyc, line 73, in showLookupDialog
   File wx\_core.pyc, line 7978, in __init__
   File wx\_core.pyc, line 7552, in _BootstrapApp
   File dict.pyc, line 26, in OnInit
 AttributeError: 'NoneType' object has no attribute 'Bind'
 Traceback (most recent call last):
   File sw.pyw, line 217, in module
   File dict.pyc, line 73, in showLookupDialog
   File wx\_core.pyc, line 7978, in __init__
   File wx\_core.pyc, line 7552, in _BootstrapApp
   File dict.pyc, line 26, in OnInit
 AttributeError: 'NoneType' object has no attribute 'Bind'

 --
 Have a great day,
 Alex (msg sent from GMail website)
 mehg...@gmail.com;http://www.facebook.com/mehgcap

This may or may not have something to do with it:

For Python 2.6, the DLL you need is called MSVCR90.dll. Py2exe is not
able to automatically include this DLL in your dist directory, so you
must provide it yourself.

To complicate things, there is more than one version of this DLL in
existance, each with the same filename. You need the same version that
the Python interpreter was compiled with, which is version
9.0.21022.8. Through the remainder of these instructions, hover your
mouse over the dll file (or the vcredist_x86.exe installer executable)
to confirm which version you've got.
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: expy 0.6.4 released!

2010-04-26 Thread Yingjie Lan
expy is an express way to extend python.

It is written in pure python and very light weight.

I have been using this in a big project and the outcome is quite satisfying.

What's New: 

1. now generated header files are separate from implementation files.
2. bug fixes.
3. updated documentation.

For more information and tutorial: http://expy.sourceforge.net/

Cheers,

Yingjie


  
-- 
http://mail.python.org/mailman/listinfo/python-list


WIN32 - get the GUID of a Network Device

2010-04-26 Thread Richard Lamboj

Hello,

is there a way to get the GUID from a Network Device?

Kind Regard,

Richi
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WIN32 - get the GUID of a Network Device

2010-04-26 Thread Tim Golden

On 26/04/2010 09:06, Richard Lamboj wrote:

is there a way to get the GUID from a Network Device?


Are you talking about the MAC address? If so, here's
one way:

code
import wmi

for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration ():
  print nic.caption, =, nic.MACAddress

/code

If you're not, then which GUID are you referring to?

TJG
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to debug python application crashed occasionally

2010-04-26 Thread Helmut Jarausch
On 04/25/10 08:32, jacky wang wrote:
 could anyone help me?
 
 
 On Apr 21, 2:55 pm, jacky wang bugking.w...@gmail.com wrote:
 Hello

   recently, I met a problem with one python application running with
 python2.5 | debian/lenny adm64 system: it crashed occasionally in our
 production environment. The problem started to happen just after we
 upgraded the python application from python2.4 | debian/etch amd64.

   after configuring the system to enable core dump  debugging with
 the core dumps by following the guide line 
 fromhttp://wiki.python.org/moin/DebuggingWithGdb,
 I became more confused about that.

   The first crash case was happening in calling python-xml module,
 which is claimed as a pure python module, and it's not supposed to
 crash python interpreter. because the python application is relatively
 a big one, I can not show u guys the exact source code related with
 the crash, but only the piece of python modules. GDB shows it's
 crashed at string join operation:

 #0  string_join (self=0x7f7075baf030, orig=value optimized out)
 at ../Objects/stringobject.c:1795
 1795../Objects/stringobject.c: No such file or directory.
 in ../Objects/stringobject.c

 and pystack macro shows the details:

 gdb) pystack
 /usr/lib/python2.5/StringIO.py (271): getvalue
 /usr/lib/python2.5/site-packages/_xmlplus/dom/minidom.py (62):
 toprettyxml
 /usr/lib/python2.5/site-packages/_xmlplus/dom/minidom.py (47): toxml

   at that time, we also found python-xml module has performance issue
 for our application, so we decided to use python-lxml to replace
 python-xml. After that replacement, the crash was gone. That's a bit
 weird for me, but anyway, it's gone.

   Unfortunately, another two 'kinds' of crashes happening after that,
 and the core dumps show they are not related with the replacement.

   One is crashed with Program terminated with signal 11, and the
 pystack macro shows it's crashed at calling the built-in id()
 function.

 #0  visit_decref (op=0x20200a3e22726574, data=0x0) at ../Modules/
 gcmodule.c:270
 270 ../Modules/gcmodule.c: No such file or directory.
 in ../Modules/gcmodule.c

   Another is crashed with Program terminated with signal 7, and the
 pystack macro shows it's crashed at the exactly same operation (string
 join) as the first one (python-xml), but in different library python-
 simplejson:

 #0  string_join (self=0x7f5149877030, orig=value optimized out)
 at ../Objects/stringobject.c:1795
 1795../Objects/stringobject.c: No such file or directory.
 in ../Objects/stringobject.c

 (gdb) pystack
 /var/lib/python-support/python2.5/simplejson/encoder.py (367): encode
 /var/lib/python-support/python2.5/simplejson/__init__.py (243): dumps

   I'm not good at using gdb  C programming, then I tried some other
 ways to dig further:
* get the source code of python2.5, but can not figure out the
 crash reason :(
* since Debian distribution provides python-dbg package, and I
 tried to use python2.5-dbg interpreter, but not the python2.5, so that
 I can get more debug information in the core dump file. Unfortunately,
 my python application is using a bunch of C modules, and not all of
 them provides -dbg package in Debian/Lenny. So it still doesn't make
 any progress yet.

   I will be really appreciated if somebody can help me about how to
 debug the python crashes.


For me, it sounds like a hardware problem. Have run memory tests like
memtest86+ and/or memtester?

You could try a more recent version of Python like 2.6.5 and see if
you get the same sort of errors.

Try to run your application on a different machine if possible, to
exclude hardware errors.

Have you rebuild all Python packages you're using and which use an
extension in C / C++ ? after upgrading?

I hope this helps a bit,
Helmut.



-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WIN32 - get the GUID of a Network Device

2010-04-26 Thread Richard Lamboj

Am Monday 26 April 2010 10:14:24 schrieb Tim Golden:
 On 26/04/2010 09:06, Richard Lamboj wrote:
  is there a way to get the GUID from a Network Device?

 Are you talking about the MAC address? If so, here's
 one way:

 code
 import wmi

 for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration ():
print nic.caption, =, nic.MACAddress

 /code

 If you're not, then which GUID are you referring to?

 TJG

Hello,

thanks for your response. No, i don't mean the MAC Address. I mean the GUID - 
Sample: {1E2428C1-9F2C-48D7-AB53-3229DFB7E217}

I want to change TcpAckFrequency and TcpDelTicks of a Network Interface. I Try 
to change it over the Registry, but maybe there is another way?

Kind Regards,

Richi
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Stefan Krah
Chris Rebert c...@rebertia.com wrote:
  c = decimal.Context(prec=5)
  decimal.Decimal(1234567).to_eng_string(c)
  '1234567'
 
  That is not an engineering notation string.
 
 Apparently either you and the General Decimal Arithmetic spec differ
 on what constitutes engineering notation, there's a bug in the Python
 decimal library, or you're hitting some obscure part of the spec's
 definition. I don't have the expertise to know which is the case.
 
 The spec: http://speleotrove.com/decimal/decarith.pdf
 (to-engineering-string is on page 20 if you're interested)

The module is correct. Printing without exponent follows the same rules
as to-scientific-string:

If the exponent is less than or equal to zero and the adjusted exponent
 is greater than or equal to -6, the number will be converted to a
 character form without using exponential notation.


Stefan Krah


-- 
http://mail.python.org/mailman/listinfo/python-list


Completely Deleting A Directory

2010-04-26 Thread Lawrence D'Oliveiro
It doesn’t seem to mention in the documentation for os.walk 
http://docs.python.org/library/os.html that symlinks to directories are 
returned in the list of directories, not the list of files. This will lead 
to an error in the os.rmdir call in the example directory-deletion routine 
on that page.

This version fixes that problem.

def delete_dir(dir) :
deletes dir and all its contents.
if os.path.isdir(dir) :
for parent, dirs, files in os.walk(dir, topdown = False) :
for item in files :
os.remove(os.path.join(parent, item))
#end for
for item in dirs :
item = os.path.join(parent, item)
(os.rmdir, os.remove)[os.path.islink(item)](item)
#end for
#end for
os.rmdir(dir)
#end if
#end delete_dir

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Stefan Krah
Keith keith.braff...@gmail.com wrote:
 Even though this uses the to_eng_string() function, and even though I
 am using the decimal.Context class:
 
  c = decimal.Context(prec=5)
  decimal.Decimal(1234567).to_eng_string(c)
 '1234567'
 
 That is not an engineering notation string.

To clarify further: The spec says that the printing functions are not
context sensitive, so to_eng_string does not *apply* the context.

The context is only passed in for the 'capitals' value, which determines
whether the exponent letter is printed in lower or upper case.


This is one of the unfortunate situations where passing a context can
create great confusion for the user. Another one is:


 c = Context(prec=5)
 Decimal(12345678, c)
Decimal('12345678')


Here the context is passed only for the 'flags' and 'traps' members:

 Decimal(wrong, c)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.2/decimal.py, line 548, in __new__
Invalid literal for Decimal: %r % value)
  File /usr/lib/python3.2/decimal.py, line 3836, in _raise_error
raise error(explanation)
decimal.InvalidOperation: Invalid literal for Decimal: 'wrong'


c.traps[InvalidOperation] = False
 Decimal(wrong, c)
Decimal('NaN')


Stefan Krah



-- 
http://mail.python.org/mailman/listinfo/python-list


Make money online

2010-04-26 Thread kutty
===
www.workpartorfulltime.blogspot.com
===
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Download Proprietary Microsoft Products Now

2010-04-26 Thread Lawrence D'Oliveiro
Just been looking at this review of Visual Studio 2010 
http://www.theregister.co.uk/2010/04/26/blowing_bubbtles/:

... the 2GB ISO was quicker to download than it was to install - not
even counting the several reboots required.

Since when do you need to REBOOT just to install a development environment?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WIN32 - get the GUID of a Network Device

2010-04-26 Thread Tim Golden

On 26/04/2010 09:49, Richard Lamboj wrote:

thanks for your response. No, i don't mean the MAC Address. I mean the GUID -
Sample: {1E2428C1-9F2C-48D7-AB53-3229DFB7E217}

I want to change TcpAckFrequency and TcpDelTicks of a Network Interface. I Try
to change it over the Registry, but maybe there is another way?


OK; I'm going to hope that Tim Roberts or someone equally knowledgeable can
kick in here as devices really isn't my area. However this looks like it *might*
be doing what you want:

code
import wmi

for nic in c.Win32_NetworkAdapter (MACAddress=i.MACAddress):
  for pnp in c.Win32_PNPEntity (DeviceID=nic.PNPDeviceID):
print pnp.Caption, =, pnp.ClassGuid

/code

TJG
--
http://mail.python.org/mailman/listinfo/python-list


Re: DLLs loading in interpreter but not with direct run on Windows

2010-04-26 Thread JTimoty
Sorry guys, the problem seems to be less general.

Actually, the error is triggered when I try to import numpy before
PyQt4. It imports without any problems after PyQt4.

I still don't know what the problem actually is, but at least my
scripts work.

Thanks,

Tim.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WIN32 - get the GUID of a Network Device

2010-04-26 Thread Tim Golden

On 26/04/2010 11:47, Tim Golden wrote:

OK; I'm going to hope that Tim Roberts or someone equally knowledgeable can
kick in here as devices really isn't my area. However this looks like it *might*
be doing what you want:

code
import wmi

for nic in c.Win32_NetworkAdapter (MACAddress=i.MACAddress):
for pnp in c.Win32_PNPEntity (DeviceID=nic.PNPDeviceID):
  print pnp.Caption, =, pnp.ClassGuid

/code


[replying to self] Please ignore that: not only does the code not
work, due to some rough cut-and-pasting, it also doesn't produce
the GUID you wanted. Sorry. Hopefully someone else has a clue.

TJG
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to choose a debugger

2010-04-26 Thread Fabio Zadrozny
2010/4/25 sanam singh sanamsi...@hotmail.com:
 Hi,
 I want to debug my c++blocks which are dynamically loaded into python for
 execution. I am using wingide for debugging python. But its limitation is
 that when c++module is called in python script it doent take me into c++
 module. What I want is that I should be able to visually see the c++ code
 (unlike gdb) when it is called from the python script and I should be able
 to debug it ( step out, step into etc).And when c++ module ends it should
 take me back into the python module. In other words, I want to follow my
 program line by line.
 Please guide me.
 Thank you.
 Regards,
 Sanam


Hi Sanam,

The usual way to work that way is having one of the debuggers work in
remote debug mode (so, if you launch it from a python ide, the c++
remote debugger should connect to it remotely, or if you launch it
from the c++ ide, the python debugger should connect to it remotely).

What I usually use is the pydev remote debugger
(http://pydev.org/manual_adv_remote_debugger.html) and msvc (through
tools  attach to process).

Cheers,

Fabio
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Making special method names, work with __getattr__

2010-04-26 Thread Antoon Pardon
Op 2010-04-23, Chris Rebert schreef c...@rebertia.com:
 On Fri, Apr 23, 2010 at 2:41 AM, Antoon Pardon apar...@forel.vub.ac.be 
 wrote:
 test()

 --

 The result I get is:

 5
 8
 15
 Traceback (most recent call last):
  File Symbolics, line 54, in module
    test()
  File Symbolics, line 51, in test
    product = val1 * 7
 TypeError: unsupported operand type(s) for *: 'Symbol' and 'int'

 What I had hoped for was, that the line:

  product = val1 * 7

 would be translated into something like

  product = val1.__mul__(7)

 That's basically correct.

 which would then be treated by the __getattr__ of the Expression superclass.

 That doesn't seem to happen.

 Indeed it doesn't. The lookup of fouble-underscore special methods
 bypasses __getattribute__() and friends. For details, see
 http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-classes

This doesn't seem to be the whole picture.

If I replace the line:

  product = val1 * 7

with

  product = val1.__mul__(7)


The code works.

So the problem is not that the lookup for special methods is different.
It seems that the lookup for special methods differ depending on wether they are
called implicitly or explicitly.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Making special method names, work with __getattr__

2010-04-26 Thread Chris Rebert
On Mon, Apr 26, 2010 at 3:57 AM, Antoon Pardon apar...@forel.vub.ac.be wrote:
 Op 2010-04-23, Chris Rebert schreef c...@rebertia.com:
 On Fri, Apr 23, 2010 at 2:41 AM, Antoon Pardon apar...@forel.vub.ac.be 
 wrote:
 The result I get is:

 5
 8
 15
 Traceback (most recent call last):
  File Symbolics, line 54, in module
    test()
  File Symbolics, line 51, in test
    product = val1 * 7
 TypeError: unsupported operand type(s) for *: 'Symbol' and 'int'

 What I had hoped for was, that the line:

  product = val1 * 7

 would be translated into something like

  product = val1.__mul__(7)

 That's basically correct.

 which would then be treated by the __getattr__ of the Expression superclass.

 That doesn't seem to happen.

 Indeed it doesn't. The lookup of fouble-underscore special methods
 bypasses __getattribute__() and friends. For details, see
 http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-classes

 This doesn't seem to be the whole picture.

 If I replace the line:

  product = val1 * 7

 with

  product = val1.__mul__(7)

 The code works.

 So the problem is not that the lookup for special methods is different.
 It seems that the lookup for special methods differ depending on wether they 
 are
 called implicitly or explicitly.

I suppose that's true. Only a minor detail in practice though, as
__double_underscore__ methods are seldom (though not never) called
explicitly.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] pyjamas 0.7 released

2010-04-26 Thread Daniel Fetchinson
 for fits and giggles, to show what's possible in only 400
 lines of python, here is a game of asteroids, written by joe rumsey.
 yes, it runs under pyjamas-desktop too.

 http://pyjs.org/examples/asteroids/public/Space.html

This URL returns a blank page for me on firefox 3.3.5 (linux) with and
without adblock plus.

 http://pyjs.org/examples/asteroids/output/Space.html works. (Firefox
 3.6.3 with ABP, Chrome 4.1)

Thanks, this link indeed works! And a pretty cool game too!

Cheers,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
http://mail.python.org/mailman/listinfo/python-list


GOZERBOT 0.9.2 BETA1 released

2010-04-26 Thread Bart Thate
I just released the first BETA of GOZERBOT version 0.9.2

Please test this release if you can.

Best is to run of the mercurial repo:

hg clone http://core.gozerbot.org/hg/dev/0.9

or run easy_install -U gozerbot gozerplugs (make sure there is no
gozerbot dir in your working directory.)

docs are at http://gozerbot.org/0.9.2

If you find any bugs you can report them at http://dev,gozerbot.org/

Have fun !

about GOZERBOT:

GOZERBOT is a channel bot that aids with conversation in irc channels
and jabber conference rooms. its mainly used to send notifications
(RSS, nagios, etc.) and to have custom commands made for the channel.
More then just a channel bot GOZERBOT aims to provide a platform for
the user to program his own bot and make it into something thats
usefull. This is done with a plugin structure that makes it easy to
program your own plugins. But GOZERBOT comes with some batteries
included, there are now over 100 plugins already written and ready for
use.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] pyjamas 0.7 released

2010-04-26 Thread Jean-Michel Pichavant

Luke Kenneth Casson Leighton wrote:

[snip]
  


Am I the only one getting this error ?

easy_install --prefix /home/jeanmichel -m pyjamas
Searching for pyjamas
Reading http://pypi.python.org/simple/pyjamas/
Reading http://pyjs.org
Best match: pyjamas 0.7
Downloading 
http://pypi.python.org/packages/source/P/Pyjamas/pyjamas-0.7.tgz#md5=8441b60bb3c88051799537852cceefd0

Processing pyjamas-0.7.tgz
error: Couldn't find a setup script in 
/tmp/easy_install-y3peDk/pyjamas-0.7.tgz

[1]12487 exit 1 easy_install --prefix /home/jeanmichel -m pyjamas
--
http://mail.python.org/mailman/listinfo/python-list


Re: pyjamas 0.7 released

2010-04-26 Thread lkcl
On Apr 26, 12:45 pm, Jean-Michel Pichavant jeanmic...@sequans.com
wrote:
 Luke Kenneth Casson Leighton wrote:

  [snip]

 Am I the only one getting this error ?

 yes, because you're the only one using easy_install.  you'll need to
read and follow the instructions in README and INSTALL.txt

 the installation procedure requires, without fail, that you run
python bootstrap.py which can NOT be added to a standard setup.py
script without causing massive problems.

 it is imperative that the python source which is part of the pyjamas
core libraries be kept ABSOLUTELY separate from standard http://python.org
core libraries.  implementations of os.py, sys.py, md5.py and many
more CANNOT be allowed to be part of the standard http://python.org
paths.

 these libraries cannot be treated as code

 these libraries cannot be treated as data.

 the dumb-system called easy_install cannot cope with the necessary
distinction; it does not _have_ a means to treat libraries as
critical but neither code which gets installed in the standard
place in the standard way nor data.  thus we cannot use it.

 thus, you need to read the instructions, and follow them.

 l.

 easy_install --prefix /home/jeanmichel -mpyjamas
 Searching forpyjamas
 Readinghttp://pypi.python.org/simple/pyjamas/
 Readinghttp://pyjs.org
 Best match:pyjamas0.7
 Downloadinghttp://pypi.python.org/packages/source/P/Pyjamas/pyjamas-0.7.tgz#md5=...
 Processingpyjamas-0.7.tgz
 error: Couldn't find a setup script in
 /tmp/easy_install-y3peDk/pyjamas-0.7.tgz
 [1]    12487 exit 1     easy_install --prefix /home/jeanmichel -mpyjamas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyjamas 0.7 released

2010-04-26 Thread lkcl
On Apr 25, 8:38 pm, Patrick Maupin pmau...@gmail.com wrote:
 On Apr 25, 8:49 am, Luke Kenneth Casson Leighton l...@lkcl.net
 wrote:

 pyjamas- the stand-alone python-to-javascript compiler, and separate
  GUI Widget Toolkit, has its 0.7 release, today.  this has been much
  delayed, in order to allow the community plenty of time between the
  0.7pre2 release and the final release, to review and test all the
  examples.

 I know I'm a Luddite, but what I'd really love to see to go with this
 is an easy way for the application, the browser, and the user to all
 agree that this particular application can read and write arbitrary
 files in a particular local directory.

 you'll have to be a bit clearer about what you mean, because it's
probably perfectly possible with one of the pyjamas-desktop ports, but
that would leave the browsers out in the cold, thus defeating the
purpose of pyjamas being cross-platform, cross-browser, cross-desktop
and cross-widget-set.

 A Python program you don't have to install, that executes really fast
 on one of the newer JavaScript JIT engines, with its own purely local
 data in files in a simple text format in a directory specified by the
 user,

 the purpose of browsers is to isolate the application, restrict its
access to the rest of the desktop and OS, so that random applications
cannot go digging around on your private data.

 many browsers _used_ to allow access to local files etc. but ...
yeah.

 so i think you will be able to do what you describe _if_ you provide
a browser plugin which adds the required functionality.

 google gears would be a good place to start (i've part-ported GWT
Gears to pyjamas - the SQL storage modules - to demonstrate what's
needed).

 if however you completely ignore browsers from the equation, by
virtue of having to piss about writing c code, then yes, you can use
pyjamas-desktop.  at that point, you have _full_ access to the entire
OS and system, because you're firing up the web browser engine as a
python application.

 i've done something like this with pyjdwm - http://sf.net/projects/pyjdwm

 l.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyjamas 0.7 released

2010-04-26 Thread lkcl
On Apr 25, 9:37 pm, Wolfgang Strobl ne...@mystrobl.de wrote:
 Daniel Fetchinson fetchin...@googlemail.com:

  for fits and giggles, to show what's possible in only 400
  lines of python, here is a game of asteroids, written by joe rumsey.
  yes, it runs underpyjamas-desktop too.

     http://pyjs.org/examples/asteroids/public/Space.html

 This URL returns a blank page for me on firefox 3.3.5 (linux) with and
 without adblock plus.

 http://pyjs.org/examples/asteroids/output/Space.html works. (Firefox
 3.6.3 with ABP, Chrome 4.1)

 yep.  apologies.  didn't want to play asteroids, wanted to do a
release.  joe has done an updated version (that only works with pyjs
not pyjd) which has sound.  it uses a hidden iframe containing an
adobe swf plugin, and javascript to communicate with the hidden
iframe, sending it commands to play certain sounds at certain
volumes.  once i work out how to do the same trick in pyjd, it'll get
added.

 l.

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Need help with basic DOM XML tree traversing

2010-04-26 Thread Barak, Ron
 -Original Message-
 From: Stefan Behnel [mailto:stefan...@behnel.de] 
 Sent: Sunday, April 25, 2010 6:42 PM
 To: python-list@python.org
 Subject: Re: Need help with basic DOM XML tree traversing
 
 Barak, Ron, 25.04.2010 17:06:
  This is my first try at XML with Python, and though I tried 
 to read on the web, I'm unable to traverse a DOM tree, as my 
 top element seems to be DOCUMENT_NODE and I cannot find a way 
 to get to the nodes below it.
 
 You might find the xml.etree.ElementTree package a lot easier 
 to work with.
 
 
  $ python -u xml_parse.py
  node:xml.dom.minidom.DocumentType instance at 0x00DE25A8
  dom2.nodeType: 9
  dom2.nodeName: #document
  node is DOCUMENT_NODE:xml.dom.minidom.DocumentType instance at 
  0x00DE25A8 node:DOM Element: database at 0xde2698
  dom2.nodeType: 9
  dom2.nodeName: #document
  node is DOCUMENT_NODE:DOM Element: database at 0xde2698 
  ('dom2._get_childNodes():', [xml.dom.minidom.DocumentType 
 instance at 
  0x00DE25A8,DOM Element: database at 0xde2698]) Traceback 
 (most recent call last):
 File xml_parse.py, line 26, inmodule
   
  
 print(child_nodes._get_childNodes():,child_nodes._get_childNodes())
  AttributeError: 'NodeList' object has no attribute '_get_childNodes'
 
 childNodes is a property, use it like
 
  print(child_nodes.childNodes:, child_nodes.childNodes)
 
 By convention, the underscore at the beginning of _get_childNodes 
 indicates that it is not considered a public method.
 
 Stefan
 
 


Hi Stefan,
Thanks for the excellent pointer to xml.etree.ElementTree: it sure makes life 
easier :-)
Bye,
Ron.
 
-- 
http://mail.python.org/mailman/listinfo/python-list


HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHS ON http

2010-04-26 Thread Naeem
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON
http://hollywood6y.blogspot.com/ HOLLYWOOD ACTRESS
BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE NICOLE KIDMAN
HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD ACTRES SEXY
HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON   
http://hollywood6y.blogspot.com/
HOLLYWOOD ACTRESS BRITENY SPEARS ANGLIANA JOLI KATE VINSLATE
NICOLE KIDMAN HOLLYWOOD ACTRESS BOLLYWOOD ACTRESS LOLLYWOOD
ACTRES SEXY HOLLYWOOD ACTRESS GIRLS WITHOUT CLOTHSON

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Grant Edwards
On 2010-04-26, Keith keith.braff...@gmail.com wrote:

 I am considering writing a PEP for the inclusion of an engineering
 format specifier, and would appreciate input from others.

I very regularly do something similar in various apps, though I often
want to specify the exponent (e.g. I always want to print a given
value in mega scaling even if that ends up as 0.090e3 or 1000.010e3.

So I would suggest adding an optional exponent value such that %3n
would always result in whatevere+03

-- 
Grant Edwards   grant.b.edwardsYow! You were s'posed
  at   to laugh!
  gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


how to select column

2010-04-26 Thread mannu jha
Dear all,

I am new in python, can anyone help me that how can I select two column out of 
6 column from a file.
For example if I have file like:

a1 a2 a3 a4 a5 a6
b1 b2 b3 b4 b5 b6
c1 c2 c3 c4 c5 c6
d1 d2 d3 d4 d5 d6 

and I want output like:

a1 a4
b1 b4
c1 c4
d1 d4

then how to do

Thanks -- 
http://mail.python.org/mailman/listinfo/python-list


PyDev : undefined variable from import

2010-04-26 Thread Wanderer
Since the last Java update, I get the error, undefined variable from
import in Pydev in the Eclipse editor. I can still run the program in
Eclipse. If I add a blank line and save the program, the error goes
away, but that screws up the revision with SVN. Has anyone else seen
this or have a fix.

Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to select column

2010-04-26 Thread Gary Herron

mannu jha wrote:

Dear all,

I am new in python, can anyone help me that how can I select two 
column out of 6 column from a file.

For example if I have file like:

a1 a2 a3 a4 a5 a6
b1 b2 b3 b4 b5 b6
c1 c2 c3 c4 c5 c6
d1 d2 d3 d4 d5 d6

and I want output like:

a1 a4
b1 b4
c1 c4
d1 d4

then how to do

Thanks 



Do you know how to open a file, and how to read individual lines from it?

If so, then you can split a line at the spaces into a list by using
 fields = line.split()
Then
 print fields[0], fields[3]
would do what you ask.



Gary Herron



--
http://mail.python.org/mailman/listinfo/python-list


Re: how to select column

2010-04-26 Thread J. Cliff Dyer
It depends on what you mean by a column.  I assume your data is more
complex than what you've shown us.  

If your data is really single words separated by spaces, you can do:

for line in open('file'):
columns = line.split()
return columns[0], columns[3]

If your columns can have spaces within them, or are separated in other
ways, you'll need something else.  

Cheers,
Cliff


On Mon, 2010-04-26 at 14:50 +, mannu jha wrote:
 Dear all,
 
 I am new in python, can anyone help me that how can I select two
 column out of 6 column from a file.
 For example if I have file like:
 
 a1 a2 a3 a4 a5 a6
 b1 b2 b3 b4 b5 b6
 c1 c2 c3 c4 c5 c6
 d1 d2 d3 d4 d5 d6 
 
 and I want output like:
 
 a1 a4
 b1 b4
 c1 c4
 d1 d4
 
 then how to do
 
 Thanks 


-- 
http://mail.python.org/mailman/listinfo/python-list


Python date time API

2010-04-26 Thread rk
Hi,

 I am python novice, trying to convert a boost::gregorian::date out to
python using PyDateTime C-api interface. I was coring because the C-
API failed to initialize. The error was:

AttributeError: module object has not attribute datetime_CAPI

As indicated by the error, a dir(datetime) gives me the following
output.

['MAXYEAR', 'MINYEAR', '__doc__', '__file__', '__name__', 'date',
'datetime', 'time', 'timedelta', 'tzinfo']

I am note sure why datetime_CAPI is missing? I would appreciate any
input.

Regards,
Ramesh
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Completely Deleting A Directory

2010-04-26 Thread MrJean1
Two comments:

1) Should delete_dir not be called instead of os.rmdir in this line

(os.rmdir, os.remove)[os.path.islink(item)](item)

2) Function rmtree in the shutil module considers symlinks to a
directory an error http://docs.python.org/library/shutil.html#module-
shutil since Python 2.6.

/Jean


On Apr 26, 2:09 am, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
 It doesn’t seem to mention in the documentation for os.walk
 http://docs.python.org/library/os.html that symlinks to directories are
 returned in the list of directories, not the list of files. This will lead
 to an error in the os.rmdir call in the example directory-deletion routine
 on that page.

 This version fixes that problem.

 def delete_dir(dir) :
     deletes dir and all its contents.
     if os.path.isdir(dir) :
         for parent, dirs, files in os.walk(dir, topdown = False) :
             for item in files :
                 os.remove(os.path.join(parent, item))
             #end for
             for item in dirs :
                 item = os.path.join(parent, item)
                 (os.rmdir, os.remove)[os.path.islink(item)](item)
             #end for
         #end for
         os.rmdir(dir)
     #end if
 #end delete_dir

-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN]: 'tren' Cross-Platform Batch Renaming Tool, Version 1.217 Released

2010-04-26 Thread Tim Daneliuk
'tren' Version 1.217 is now released and available for download at:

 http://www.tundraware.com/Software/tren

-

What's New In This Release?
---

This is the initial public release.

What Is 'tren'?
--

'tren' is a general purpose file and directory renaming
tool. Unlike commands like 'mv', 'tren' is particularly well
suited for renaming *batches* of files and/or directories with a
single command line invocation.  'tren' eliminates the tedium of
having to script simpler tools to provide higher-level renaming
capabilities.

'tren' is also adept at renaming only *part of an existing file
or directory name* either based on a literal string or a regular
expression pattern.  You can replace any single, group, or all
instances of a given string in a file or directory name.

'tren' implements the idea of a *renaming token*.  These are
special names you can embed in your renaming requests that
represent things like the file's original name, its length, date
of creation, and so on.  There are even renaming tokens that will
substitute the content of any environment variable or the results
of running a program from a shell back into the new file name.

'tren' can automatically generate *sequences* of file names based
on their dates, lengths, times within a given date, and so on.
In fact, sequences can be generated on the basis of any of the
file's 'stat' information.  Sequence numbers can be ascending
or descending and the count can start at any initial value.
Counting can take place in one of several internally defined
counting alphabets (decimal, hex, octal, alpha, etc.) OR you
can define your own counting alphabet.  This allows you to create
sequences in any base (2 or higher please :) using any symbol set
for the count.

'tren' is written in pure Python and requires Python version
2.6.x or later.  It is known to run on various Unix-like
variants (FreeBSD, Linux, MacOS X) as well as Windows.  It will
also take advantage of 'win32all' Python extensions on a Windows
system, if they are present.

-

Complete details of all fixes, changes, and new features can be found in
the WHATSNEW.txt and documentation files included in the distribution.

A FreeBSD port has been submitted as well.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python date time API

2010-04-26 Thread Jason Scheirer
On Apr 26, 8:21 am, rk kadambi...@gmail.com wrote:
 Hi,

  I am python novice, trying to convert a boost::gregorian::date out to
 python using PyDateTime C-api interface. I was coring because the C-
 API failed to initialize. The error was:

 AttributeError: module object has not attribute datetime_CAPI

 As indicated by the error, a dir(datetime) gives me the following
 output.

 ['MAXYEAR', 'MINYEAR', '__doc__', '__file__', '__name__', 'date',
 'datetime', 'time', 'timedelta', 'tzinfo']

 I am note sure why datetime_CAPI is missing? I would appreciate any
 input.

 Regards,
 Ramesh

You MUST use the PyDateTime_IMPORT; macro at the top ov EVERY scope in
which you are using the DateTime C API.
-- 
http://mail.python.org/mailman/listinfo/python-list


running .py files on Linux

2010-04-26 Thread Tingting HAN
Dear Officer,
I downloaded a C code packet which contains many .py files. When I try to
run these.py files on my computer with Linux system, for every .py file the
following error occurs:

hantingt...@tityro:~/Downloads/triMC3D/python$ python

Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)

[GCC 4.4.1] on linux2

Type help, copyright, credits or license for more information.



[4]+  Stopped python

hantingt...@tityro:~/Downloads/triMC3D/python$ python test_detector.py

Traceback (most recent call last):

  File test_detector.py, line 9, in module

from tables import *

  File /usr/lib/python2.6/dist-packages/tables/__init__.py, line 76, in
module

from tables.file import File, openFile, copyFile

  File /usr/lib/python2.6/dist-packages/tables/file.py, line 44, in
module

from tables import hdf5Extension

  File hdf5Extension.pyx, line 11, in hdf5Extension

ImportError: No module named utilsExtension
I downloaded the .

I sincerely hope you could give me some advice to solve the problem.

-- 
Best regards,
HAN Tingting

ETSI de Telecomunicación - office C-203-1
Dpto. Ingeniería Electrónica
Ciudad Universitaria s/n
Madrid 28040,  Spain
TEL: +34 65 232 4340
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Completely Deleting A Directory

2010-04-26 Thread MrJean1
The answer to 1) is no, due to topdown = False in the call to os.walk.

/Jean

On Apr 26, 8:31 am, MrJean1 mrje...@gmail.com wrote:
 Two comments:

 1) Should delete_dir not be called instead of os.rmdir in this line

                 (os.rmdir, os.remove)[os.path.islink(item)](item)

 2) Function rmtree in the shutil module considers symlinks to a
 directory an error http://docs.python.org/library/shutil.html#module-
 shutil since Python 2.6.

 /Jean

 On Apr 26, 2:09 am, Lawrence D'Oliveiro l...@geek-



 central.gen.new_zealand wrote:
  It doesn’t seem to mention in the documentation for os.walk
  http://docs.python.org/library/os.html that symlinks to directories are
  returned in the list of directories, not the list of files. This will lead
  to an error in the os.rmdir call in the example directory-deletion routine
  on that page.

  This version fixes that problem.

  def delete_dir(dir) :
      deletes dir and all its contents.
      if os.path.isdir(dir) :
          for parent, dirs, files in os.walk(dir, topdown = False) :
              for item in files :
                  os.remove(os.path.join(parent, item))
              #end for
              for item in dirs :
                  item = os.path.join(parent, item)
                  (os.rmdir, os.remove)[os.path.islink(item)](item)
              #end for
          #end for
          os.rmdir(dir)
      #end if
  #end delete_dir

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: how to select column

2010-04-26 Thread mannu jha
Dear Sir,

Thanks for your help..but yes my files are having column like:

#  RESIDUE AA STRUCTURE BP1 BP2  ACC N-H--OO--H-NN-H--O
O--H-NTCO  KAPPA ALPHA  PHI   PSIX-CA   Y-CA   Z-CA 
12 A I  0   0   91  0, 0.038,-0.1 0, 0.0 
5,-0.0   0.000 360.0 360.0 360.0 156.1   38.1   24.6   -5.0
23 A R  - 0   0   86  1,-0.1 4,-1.838,-0.1 
3,-1.0  -0.377 360.0-116.9 -66.2 144.2   35.1   25.2   -7.3
34 A P  H 3 S+ 0   0   81  0, 0.0 4,-2.7 0, 0.0 
5,-0.2   0.843 111.7  60.4 -55.3 -36.8   34.6   28.8   -8.2

and in the output I want just:
2 A I
3 A R  -
4 A P  H 3 S+

i.e. residue no., aa and seconday structure.

Thanks
 

On Mon, 26 Apr 2010 20:40:55 +0530  wrote
mannu jha wrote:

 Dear all,



 I am new in python, can anyone help me that how can I select two 

 column out of 6 column from a file.

 For example if I have file like:



 a1 a2 a3 a4 a5 a6

 b1 b2 b3 b4 b5 b6

 c1 c2 c3 c4 c5 c6

 d1 d2 d3 d4 d5 d6



 and I want output like:



 a1 a4

 b1 b4

 c1 c4

 d1 d4



 then how to do



 Thanks 





Do you know how to open a file, and how to read individual lines from it?



If so, then you can split a line at the spaces into a list by using

 fields = line.split()

Then

 print fields[0], fields[3]

would do what you ask.







Gary Herron







-- 

http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Propietary binary serial port protocols

2010-04-26 Thread jon vs. python
Hi,
I'm working in several helper tools to parse, simulate, etc. propietary
binary serial port protocols. I'm trying to find out which is the best
internal data representation. Bytearrays seem to be the best choice, but I'd
like some feedback from more experienced developers; because I took a look
to scapy's source code and didn't see any of those...
Thanks, Jon.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: running .py files on Linux

2010-04-26 Thread alex goretoy
make sure the tar, zip or package you downloaded isn't corrupt. verify it
with a md5sum and then extract it. just a thought.
Thank you,
-Alex Goretoy
http://launchpad.net/~a1g


On Mon, Apr 26, 2010 at 11:05 AM, Tingting HAN hihigh...@gmail.com wrote:

 Dear Officer,
 I downloaded a C code packet which contains many .py files. When I try to
 run these.py files on my computer with Linux system, for every .py file the
 following error occurs:

 hantingt...@tityro:~/Downloads/triMC3D/python$ python

 Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)

 [GCC 4.4.1] on linux2

 Type help, copyright, credits or license for more information.

 

 [4]+  Stopped python

 hantingt...@tityro:~/Downloads/triMC3D/python$ python test_detector.py

 Traceback (most recent call last):

   File test_detector.py, line 9, in module

 from tables import *

   File /usr/lib/python2.6/dist-packages/tables/__init__.py, line 76, in
 module

 from tables.file import File, openFile, copyFile

   File /usr/lib/python2.6/dist-packages/tables/file.py, line 44, in
 module

 from tables import hdf5Extension

   File hdf5Extension.pyx, line 11, in hdf5Extension

 ImportError: No module named utilsExtension
 I downloaded the .

 I sincerely hope you could give me some advice to solve the problem.

 --
 Best regards,
 HAN Tingting

 ETSI de Telecomunicación - office C-203-1
 Dpto. Ingeniería Electrónica
 Ciudad Universitaria s/n
 Madrid 28040,  Spain
 TEL: +34 65 232 4340


 --
 http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list


Some objects missing from tkinter

2010-04-26 Thread Shane
I'm new to Python, so I'll try to be clear about my problem.

I'm using Python 3.1 (latest stable version from python.org) on
Windows 7.
I have a program using tkinter for UI, and it works properly from both
pything GUI shell, and running from command prompt, EXCEPT that I have
a menu command to invoke tkinter.filedialog.askopenfile, and it fails
because it says:

file = tkinter.filedialog.askopenfilename()
AttributeError: 'module' object has no attribute 'filedialog'

I made a simple test program:

import tkinter
print (dir(tkinter))

when I run this from the GUI shell, the results include filedialog,
but from the command prompt, it does not (also missing other
attributes, such as messagebox).

All the UI widgets work properly.
My best hypothesis at this point is that from the GUI shell its using
the source code under lib\tkinter (where there is a filedialog.py),
but from the command shell it is using the compiled dll, and that
doesn't export filedialog for some reason.

Thanks in advance for any suggestions
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some objects missing from tkinter

2010-04-26 Thread Peter Otten
Shane wrote:

 I'm new to Python, so I'll try to be clear about my problem.
 
 I'm using Python 3.1 (latest stable version from python.org) on
 Windows 7.
 I have a program using tkinter for UI, and it works properly from both
 pything GUI shell, and running from command prompt, EXCEPT that I have
 a menu command to invoke tkinter.filedialog.askopenfile, and it fails
 because it says:
 
 file = tkinter.filedialog.askopenfilename()
 AttributeError: 'module' object has no attribute 'filedialog'
 
 I made a simple test program:
 
 import tkinter
 print (dir(tkinter))
 
 when I run this from the GUI shell, the results include filedialog,
 but from the command prompt, it does not (also missing other
 attributes, such as messagebox).
 
 All the UI widgets work properly.
 My best hypothesis at this point is that from the GUI shell its using
 the source code under lib\tkinter (where there is a filedialog.py),
 but from the command shell it is using the compiled dll, and that
 doesn't export filedialog for some reason.


It's not that complicated; idle and your module share the same python 
interpreter and the same tkinter package. Idle needs a file dialog, too, and 
somewhere in its code there must be a

import tkinter.filedialog

statement which of course isn't executed when you run your script from the 
command line. To fix your script simply add the above import statement.

It is a bit unfortunate that your editor has side effects on your program, 
and I recommend that you never trust the result of importing a module from 
within idle's shell completely.

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


dictionary

2010-04-26 Thread gopi krishna
When I give a dictionary with key and value in order how can get back  iy in
same order
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: dictionary

2010-04-26 Thread Benjamin Kaplan
On Mon, Apr 26, 2010 at 2:04 PM, gopi krishna dasarathulag...@gmail.comwrote:

 When I give a dictionary with key and value in order how can get back  iy
 in same order


You can't using the standard dict type. If you're using Python 3.1, you can
use collections.OrderedDict instead. Otherwise, you'll just have to define
the type yourself. You can find the code for it all over the place if you
search for python ordered dict.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: dictionary

2010-04-26 Thread Peter Otten
gopi krishna wrote:

 When I give a dictionary with key and value in order how can get back  iy
 in same order

You can't. You either have to maintain a list of the keys in parallel, or 
use an ordered dictionary like the following:

http://code.activestate.com/recipes/576693/

It will be included in Python 2.7 and already is in 3.1:

http://docs.python.org/py3k/library/collections.html#collections.OrderedDict

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyjamas 0.7 released

2010-04-26 Thread Patrick Maupin
On Apr 26, 8:44 am, lkcl luke.leigh...@googlemail.com wrote:

  the purpose of browsers is to isolate the application, restrict its
 access to the rest of the desktop and OS, so that random applications
 cannot go digging around on your private data.

Well, I would agree that a requirement for the browser is to help
insure the user's safety, but would argue that the *purpose* is
somewhat more functional than that :-)

  many browsers _used_ to allow access to local files etc. but ...
 yeah.

I know.  But, with most browsers, you can say yes, I know I'm
downloading this Java program. I know it can have its way with my hard
drive.  Trust me; I know what I'm doing here.  Same thing with Adobe
or Microsoft stuff:  silverlight, AIR, flash, PDFs.  Basically, the
browser delegates ALL security control at that point.  I just think it
would be nice if the browser could delegate a _little_ security
control to the user (allow this JavaScript program to read/write
arbitrary files in this directory; possibly with a total file size
limitation) for programs that can run inside the browser.

  so i think you will be able to do what you describe _if_ you provide
 a browser plugin which adds the required functionality.

Agreed.  Alternatively, of course, you could have code to let the user
download to a local file from the application's local storage area
for backup purposes, but that seems suboptimal.

  google gears would be a good place to start (i've part-ported GWT
 Gears to pyjamas - the SQL storage modules - to demonstrate what's
 needed).

I think even gears assumes a database under the browser's control; not
an arbitrary node in the filesystem.  Also, I think gears is no longer
being developed.  Of course, gears could be OK as a starting point,
but really what you are saying is that everybody wanting to use this
new file local storage feature would need an add-on.  I agree that's
probable, but in that case it's only really worth doing if a lot of
projects would use it.  I'm not sure if that will come to pass or not
-- it would need a lot of programmers to think that it was a great
thing.

OTOH, if a particular browser supported this functionality natively,
then it might be a competitive advantage if applications did develop
to support it.

  if however you completely ignore browsers from the equation, by
 virtue of having to piss about writing c code, then yes, you can use
 pyjamas-desktop.  at that point, you have _full_ access to the entire
 OS and system, because you're firing up the web browser engine as a
 python application.

That's understood (and a great thing).  But if programmers could use
pyjamas in the browser without an extra download to get to all the
desktop features (which is how it *appears* to most users when they
use flash or something like that), that would be a great win.
Alternatively, a single small download of a broswer add-on package to
bring pyjamas desktop features into the browser (maybe even just for
mozilla for now) would be awesome, as well.

Regards,
Pat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Completely Deleting A Directory

2010-04-26 Thread Patrick Maupin
On Apr 26, 4:09 am, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
 It doesn’t seem to mention in the documentation for os.walk
 http://docs.python.org/library/os.html that symlinks to directories are
 returned in the list of directories, not the list of files. This will lead
 to an error in the os.rmdir call in the example directory-deletion routine
 on that page.

They should probably remove that example, and just point the user to
shutil.rmtree() (as they do under the os.rmdir() description).

Regards,
Pat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some objects missing from tkinter

2010-04-26 Thread Lie Ryan
On 04/27/10 03:50, Peter Otten wrote:
 It is a bit unfortunate that your editor has side effects on your program, 
 and I recommend that you never trust the result of importing a module from 
 within idle's shell completely.

In fact, never trust IDLE. IDLE is a nice IDE when the alternative is
Notepad; but for serious work, you need a real IDE or a programmer's
text editor (vim or emacs, whichever side you're in).

Always test the you write inside IDLE on a command line.
-- 
http://mail.python.org/mailman/listinfo/python-list


py2exe sets error message

2010-04-26 Thread Ron Adelman
getting following error message when trying to run my setup file
...\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated
 import sets
Removing files in directory :./dist,keeping protedted files...

python 2.65 new install.

Any work arounds(Hacks)??


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe sets error message

2010-04-26 Thread MRAB

Ron Adelman wrote:

getting following error message when trying to run my setup file
...\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated
 import sets

Removing files in directory :./dist,keeping protedted files...


python 2.65 new install.

Any work arounds(Hacks)??


It's not an error message, it's a warning. The 'sets' module has been
superseded because Python has a built-in 'set' class.
--
http://mail.python.org/mailman/listinfo/python-list


Re: can't get python 2.5.5 to work on mac os x 10.4.11

2010-04-26 Thread Diez B . Roggisch
new2Cocos bchk...@gmail.com wrote:
 Hi everyone,
 
 I posted this in the cocos2d and pyglet discussion group, I thought
 I'll get a response right away since my problem is quite general but I
 got no response.  I hope you will help me!!! this is the original post
 
 http://groups.google.com/group/cocos-discuss/browse_thread/thread/f8bc92498dbd48af#
 
 best regards
 

You Need a python framework build. 

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


chr(i) ASCII under Python 3

2010-04-26 Thread Dodo

Hi all,
Under python 2.6, chr() Return a string of one character whose ASCII 
code is the integer i. (quoted from docs.python.org)
Under python 3.1, chr() Return the string of one character whose 
Unicode codepoint is the integer i.


I want to convert a ASCII code back to a character under python 3, not 
Unicode.


How can I do that?

Dorian
--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach

On 26.04.2010 22:12, * Dodo:

Hi all,
Under python 2.6, chr() Return a string of one character whose ASCII
code is the integer i. (quoted from docs.python.org)
Under python 3.1, chr() Return the string of one character whose
Unicode codepoint is the integer i.

I want to convert a ASCII code back to a character under python 3, not
Unicode.

How can I do that?


Just use chr().

ASCII (7-bit) is a subset of ISO Latin-1 (7-bit), which is a subset of Unicode's 
Basic Multilingual Plane (BMP, original Unicode, 16-bit) which is a subset of 
Unicode (21-bit).



Cheers  hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list


Re: chr(i) ASCII under Python 3

2010-04-26 Thread Dodo

Le 26/04/2010 22:26, Alf P. Steinbach a écrit :

On 26.04.2010 22:12, * Dodo:

Hi all,
Under python 2.6, chr() Return a string of one character whose ASCII
code is the integer i. (quoted from docs.python.org)
Under python 3.1, chr() Return the string of one character whose
Unicode codepoint is the integer i.

I want to convert a ASCII code back to a character under python 3, not
Unicode.

How can I do that?


Just use chr().

ASCII (7-bit) is a subset of ISO Latin-1 (7-bit), which is a subset of
Unicode's Basic Multilingual Plane (BMP, original Unicode, 16-bit) which
is a subset of Unicode (21-bit).


Cheers  hth.,

- Alf


Oh, I see... thanks

* just realize the problem doesn't come from here *
--
http://mail.python.org/mailman/listinfo/python-list


Re: pyjamas 0.7 released

2010-04-26 Thread lkcl
On Apr 26, 6:52 pm, Patrick Maupin pmau...@gmail.com wrote:
 On Apr 26, 8:44 am, lkcl luke.leigh...@googlemail.com wrote:

   the purpose of browsers is to isolate the application, restrict its
  access to the rest of the desktop and OS, so that random applications
  cannot go digging around on your private data.

 Well, I would agree that a requirement for the browser is to help
 insure the user's safety, but would argue that the *purpose* is
 somewhat more functional than that :-)

 we know :)

   many browsers _used_ to allow access to local files etc. but ...
  yeah.

 I know.  But, with most browsers, you can say yes, I know I'm
 downloading this Java program.

 ... which requires a java plugin

 I know it can have its way with my hard
 drive.  Trust me; I know what I'm doing here.  Same thing with Adobe
 or Microsoft stuff:  silverlight,

 plugin

 AIR,

 aka webkit (modified) plus plugins

 flash,

 plugin

 PDFs.

 often done as a plugin (e.g. mozplugger for firefox)

  Basically, the
 browser delegates ALL security control at that point.  I just think it
 would be nice if the browser could delegate a _little_ security
 control to the user (allow this JavaScript program to read/write
 arbitrary files in this directory; possibly with a total file size
 limitation) for programs that can run inside the browser.

 on IE, this is already possible - without needing plugins.  active
scripting.  however, it requires security settings that people simply
aren't equipped to correctly modify.


   so i think you will be able to do what you describe _if_ you provide
  a browser plugin which adds the required functionality.

 Agreed.  Alternatively, of course, you could have code to let the user
 download to a local file from the application's local storage area
 for backup purposes, but that seems suboptimal.

   google gears would be a good place to start (i've part-ported GWT
  Gears topyjamas- the SQL storage modules - to demonstrate what's
  needed).

 I think even gears assumes a database under the browser's control; not
 an arbitrary node in the filesystem.  Also, I think gears is no longer
 being developed.  Of course, gears could be OK as a starting point,
 but really what you are saying is that everybody wanting to use this
 new file local storage feature would need an add-on.  I agree that's
 probable, but in that case it's only really worth doing if a lot of
 projects would use it.

 preeeciselyyy.  which is why nobody does it.

 and, given that you can use AJAX (e.g. JSONRPC) to communicate with a
server-side component, installed on 127.0.0.1 and effectively do the
exact same thing, nobody bothers.

 the JSONRPC stuff is pretty trivial (if annoying by the fact that
it's asynchronous function calls, client-side) - and there are half a
dozen server-side implementations.  the ones we recommend people use
with pyjamas are actually damn good: decorators turn an ordinary
function into a JSONRPC service with a single import and a single line
of code (decorator) per function.  that's _it_.  the actual
implementation, aside from apt-get install simplejson is about
_thirty_ lines of code (incredibly) for joining up JSONRPC to django
or web2py etc. etc.

 it's so small an amount of code that the django developers are
refusing to include it in the standard distribution, because it
doesn't look scarily complicated enough, doesn't make programming with
JSONRPC difficult enough for them, and generally makes life too
easy.  i love it when programmers get scared by code that appears to
be too easy and not stressful enough to be acceptable, because
then they stay away from me, thank goodness.

 but - yeah: JSONRPC's definitely your most sensible pragmatic
option.  server-side you can then do absolutely anything.  if you use
pyjs, you then have the advantage that the application will still work
as pure python under pyjd _even_ though it uses HTTPRequest, because i
made damn sure that the XmlHTTPRequest objects which you _expect_ to
use javascript-only _still_ work even under the three ports
(pywebkitgtk, xulrunner and MSHTML).  (that was fun-and-games and
there's still massive repercussions with the fucking crack-heads from
the webkit team over the access to XmlHTTPRequest from glib/gobject...
just don't ask for details... )


   if however you completely ignore browsers from the equation, by
  virtue of having to piss about writing c code, then yes, you can use
 pyjamas-desktop.  at that point, you have _full_ access to the entire
  OS and system, because you're firing up the web browser engine as a
  python application.

 That's understood (and a great thing).  But if programmers could usepyjamas 
 in the browser without an extra download to get to all the
 desktop features (which is how it *appears* to most users when they
 use flash or something like that),

 no - it's not going to happen: it's _required_ to install the flash
plugin.

 that would be a great win.

 yes.  if you can tolerate the plugin 

Re: WIN32 - get the GUID of a Network Device

2010-04-26 Thread Tim Roberts
Tim Golden wrote:
 On 26/04/2010 09:49, Richard Lamboj wrote:
 thanks for your response. No, i don't mean the MAC Address. I mean
 the GUID -
 Sample: {1E2428C1-9F2C-48D7-AB53-3229DFB7E217}

 I want to change TcpAckFrequency and TcpDelTicks of a Network
 Interface. I Try
 to change it over the Registry, but maybe there is another way?

 OK; I'm going to hope that Tim Roberts or someone equally
 knowledgeable can
 kick in here as devices really isn't my area. However this looks like
 it *might*
 be doing what you want:

 code
 import wmi

 for nic in c.Win32_NetworkAdapter (MACAddress=i.MACAddress):
   for pnp in c.Win32_PNPEntity (DeviceID=nic.PNPDeviceID):
 print pnp.Caption, =, pnp.ClassGuid
 /code

No, the PnP class GUID is the Class line from the top of the INF
file.  That will be the same for all network cards.

You can look up the network interface GUID in the registry, in
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards.  There's
one subkey for each interface, containing a Description and a
ServiceName.  The ServiceName is the interface GUID.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Download Proprietary Microsoft Products Now

2010-04-26 Thread Andrej Mitrovic
On Apr 26, 12:16 pm, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
 Just been looking at this review of Visual Studio 2010
 http://www.theregister.co.uk/2010/04/26/blowing_bubbtles/:

     ... the 2GB ISO was quicker to download than it was to install - not
     even counting the several reboots required.

 Since when do you need to REBOOT just to install a development environment?

Sure beats having to recompile a kernel to support 3rd party audio
drivers. But YMMV.

Although I agree, moving away from VS would be nice. Since Unladen
Swallow will eventually be merged with Python, will the dev team
consider trying out Clang as an alternative to VS?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach

On 26.04.2010 22:26, * Dodo:

Le 26/04/2010 22:26, Alf P. Steinbach a écrit :

On 26.04.2010 22:12, * Dodo:

Hi all,
Under python 2.6, chr() Return a string of one character whose ASCII
code is the integer i. (quoted from docs.python.org)
Under python 3.1, chr() Return the string of one character whose
Unicode codepoint is the integer i.

I want to convert a ASCII code back to a character under python 3, not
Unicode.

How can I do that?


Just use chr().

ASCII (7-bit) is a subset of ISO Latin-1 (7-bit), which is a subset of
Unicode's Basic Multilingual Plane (BMP, original Unicode, 16-bit) which
is a subset of Unicode (21-bit).


Cheers  hth.,

- Alf


Oh, I see... thanks

* just realize the problem doesn't come from here *


Uhm, I meant to write that ISO Latin-1 is 8-bit. Sorry. Keyboard gremlin.


Cheers,

- Alf

--
http://mail.python.org/mailman/listinfo/python-list


Re: pyjamas 0.7 released

2010-04-26 Thread Patrick Maupin
On Apr 26, 4:12 pm, lkcl luke.leigh...@googlemail.com wrote:

  and, given that you can use AJAX (e.g. JSONRPC) to communicate with a
 server-side component, installed on 127.0.0.1 and effectively do the
 exact same thing, nobody bothers.

I suppose, but again, that pushes off the security thing.  There are a
lot of obvious ways to make unintended security holes in a 127.0.0.1
application, so I'm sure there are also a lot of ways that would be
unobvious to this security non-expert.  And, of course, the real
dealbreaker is, it still requires a separate install.

  That's understood (and a great thing).  But if programmers could usepyjamas 
  in the browser without an extra download to get to all the
  desktop features (which is how it *appears* to most users when they
  use flash or something like that),

  no - it's not going to happen: it's _required_ to install the flash
 plugin.

Yeah, but *everybody knows* you have to have the flash plugin.  It's a
given.  Even if you write an exciting new flash app, probably only
0.01% of your userbase will need to install flash; everybody else will
already have it installed.

  Alternatively, a single small download of a broswer add-on package to
  bring pyjamas desktop features into the browser (maybe even just for
  mozilla for now) would be awesome, as well.

  on debian/testing: apt-get install hulahop python-xpcom - actually
 you just do apt-get install pyjamas-desktop because hulahop, python-
 xpcom are dependencies and xulrunner is a sub-dependency.

  on win32: it's an additional 350k install: python comtypes.  that's
 _it_ - that's all - and you're done: everything else is already there
 (MSHTML.DLL is the key but you need the MSXML dll as well, but, duhh,
 those come pre-installed with the OS, duhh)

  otherwise, you'd need that whopping 10mb python-inside-a-plugin, and
 i'd need to port pyjd to it. loovely.  i look forward to receiving
 sponsorship to do that (probably about 2 weeks work: it's not rocket
 science, now that there's 4 pyjd ports).

I really appreciate your thoughts and these suggestions.  But if you
could extend look, here's this awesome asteroids game, and you don't
have to install anything! to look, here's this arbitrary business
app and it stores all its data on your local machine, and you don't
have to install anything! that would be effing awesome.

Next best would be the python-in-a-plugin.  I think if someone steps
up to the plate and supports your development of that, it would make a
great delivery mechanism for programs.

Best regards,
Pat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyDev : undefined variable from import

2010-04-26 Thread Fabio Zadrozny
On Mon, Apr 26, 2010 at 12:08 PM, Wanderer wande...@dialup4less.com wrote:
 Since the last Java update, I get the error, undefined variable from
 import in Pydev in the Eclipse editor. I can still run the program in
 Eclipse. If I add a blank line and save the program, the error goes
 away, but that screws up the revision with SVN. Has anyone else seen
 this or have a fix.


The common case for this is that the static code analyzer cannot find
some token that's there at runtime... but to know the actual problem,
I need more info (such as the import that's failing and the contents
of the related modules).

Cheers,

Fabio
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Completely Deleting A Directory

2010-04-26 Thread Lawrence D'Oliveiro
In message
86bb4820-ab5a-49cc-9e64-7f7e609e4...@y6g2000prk.googlegroups.com, MrJean1 
wrote:

 2) Function rmtree in the shutil module considers symlinks to a
 directory an error
 http://docs.python.org/library/shutil.html#module-shutil since Python
 2.6.

I don’t think that applies to subdirectories. It would be stupid if it did.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Mark Dickinson
On Apr 26, 4:36 am, Keith keith.braff...@gmail.com wrote:
 I am considering writing a PEP for the inclusion of an engineering
 format specifier, and would appreciate input from others.

 [...]

 I am thinking that if we simply added something like %n (for eNgineer)
 to the list of format specifiers that we could make life easier for
 engineers:

 (%n % 12345)  == 12.345e+03
 (%n %  1234)  == 1.234e+03
 (%n %   123)  == 123e+00
 (%n % 1.2345e-5)  == 12.345e+06

I don't think there's much chance of getting changes to old-style
string formatting accepted;  you might be better off aiming at the new-
style string formatting.  (And there, the 'n' modifier is already
taken for internationalization, so you'd have to find something
different. :)

--
Mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Mark Dickinson
On Apr 26, 6:47 am, Keith keith.braff...@gmail.com wrote:
 From that document it appears that my decimal.Decimal(1234567) example
 shows that the module has a bug:

 Doc says:
 [0,123,3] ===  123E+3

 But Python does: import decimal
  decimal.Decimal(123000).to_eng_string()

 '123000'

That's not a bug.  The triple [0,123,3] is Decimal('123e3'), which is
not the same thing as Decimal('123000').  The former has an exponent
of 3 (in the language of the specification), while the latter has an
exponent of 0.

 decimal.Decimal('123e3').to_eng_string()
'123E+3'

--
Mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
Apparently either you and the General Decimal Arithmetic spec differ
on what constitutes engineering notation, there's a bug in the Python
decimal library,

You've distilled it precisely, and as you've shown in a different
post, it's the former.

The Python decimal module seems to implement correctly Mike
Cowlishaw's spec, but what that spec refers to as engineering
notation isn't really what engineers actually use.  That is, even
with decimal.Decimal.to_eng_string(), engineers still end up having to
write their own string formatting code.

I think it's worth making the print statement (or print function, as
the case may be) let us do engineering notation, just like it lets us
specify scientific notation.

--Keith Brafford
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
On Apr 26, 5:33 am, Stefan Krah stefan-use...@bytereef.org wrote:
 Keith keith.braff...@gmail.com wrote:
  Even though this uses the to_eng_string() function, and even though I
  am using the decimal.Context class:

   c = decimal.Context(prec=5)
   decimal.Decimal(1234567).to_eng_string(c)
  '1234567'

  That is not an engineering notation string.

 To clarify further: The spec says that the printing functions are not
 context sensitive, so to_eng_string does not *apply* the context.

 The context is only passed in for the 'capitals' value, which determines
 whether the exponent letter is printed in lower or upper case.

 This is one of the unfortunate situations where passing a context can
 create great confusion for the user. Another one is:

  c = Context(prec=5)
  Decimal(12345678, c)

 Decimal('12345678')

 Here the context is passed only for the 'flags' and 'traps' members:

  Decimal(wrong, c)

 Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/lib/python3.2/decimal.py, line 548, in __new__
     Invalid literal for Decimal: %r % value)
   File /usr/lib/python3.2/decimal.py, line 3836, in _raise_error
     raise error(explanation)
 decimal.InvalidOperation: Invalid literal for Decimal: 'wrong'

 c.traps[InvalidOperation] = False
  Decimal(wrong, c)

 Decimal('NaN')

 Stefan Krah

Thank you for that illustrative clarification, Stefan.  I should not
have used decimal.Context in that case, nor should I have implied that
it would have helped prove my case.

--Keith Brafford
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread MRAB

Mark Dickinson wrote:

On Apr 26, 4:36 am, Keith keith.braff...@gmail.com wrote:

I am considering writing a PEP for the inclusion of an engineering
format specifier, and would appreciate input from others.



[...]



I am thinking that if we simply added something like %n (for eNgineer)
to the list of format specifiers that we could make life easier for
engineers:

(%n % 12345)  == 12.345e+03
(%n %  1234)  == 1.234e+03
(%n %   123)  == 123e+00
(%n % 1.2345e-5)  == 12.345e+06


I don't think there's much chance of getting changes to old-style
string formatting accepted;  you might be better off aiming at the new-
style string formatting.  (And there, the 'n' modifier is already
taken for internationalization, so you'd have to find something
different. :)


e is already used, n is already used, g is already used, etc

t for powers of a thousand, perhaps? (Or m?)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
On Apr 26, 7:56 pm, Mark Dickinson dicki...@gmail.com wrote:
 On Apr 26, 6:47 am, Keith keith.braff...@gmail.com wrote:

  From that document it appears that my decimal.Decimal(1234567) example
  shows that the module has a bug:

  Doc says:
  [0,123,3] ===  123E+3

  But Python does: import decimal
   decimal.Decimal(123000).to_eng_string()

  '123000'

 That's not a bug.  The triple [0,123,3] is Decimal('123e3'), which is
 not the same thing as Decimal('123000').  The former has an exponent
 of 3 (in the language of the specification), while the latter has an
 exponent of 0.

  decimal.Decimal('123e3').to_eng_string()

 '123E+3'

 --
 Mark

Thanks, Mark, you're right.  It's clear that Decimal.to_eng_string()
doesn't solve the problem that I am trying to solve, which is: take
the Python float type, and print it in engineering format.

--Keith Brafford
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
On Apr 26, 8:47 pm, MRAB pyt...@mrabarnett.plus.com wrote:
 t for powers of a thousand, perhaps? (Or m?)

Both of those letters are fine.  I kinda like m for the whole Greco-
Roman angle, now that you point it out :-)

--Keith Brafford

-- 
http://mail.python.org/mailman/listinfo/python-list


Detect OS shutdown or user logout across different operating systems

2010-04-26 Thread python
Is there a OS portable way to have a Python script detect when
its operating system is shutting down or a user is logging out?

If not, any Windows specific tips on how to detect these events?

Thank you,
Malcolm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Detect OS shutdown or user logout across different operating systems

2010-04-26 Thread James Mills
On Tue, Apr 27, 2010 at 12:09 PM,  pyt...@bdurham.com wrote:
 Is there a OS portable way to have a Python script detect when its operating
 system is shutting down or a user is logging out?

In the Linux world, you would normally create an rc/init style script
that is invoked
at boot and shutdown (usually by calling 'start' and 'stop' on the
script respectively).

This can vary from across various distributions of Linux however and is normally
something a package maintainer might do.

I am not aware of any cross-platform way of performing what you're asking.

cheers
James
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some objects missing from tkinter

2010-04-26 Thread Shane
On Apr 26, 11:58 am, Lie Ryan lie.1...@gmail.com wrote:
 On 04/27/10 03:50, Peter Otten wrote:

  It is a bit unfortunate that your editor has side effects on your program,
  and I recommend that you never trust the result of importing a module from
  within idle's shell completely.

 In fact, never trust IDLE. IDLE is a nice IDE when the alternative is
 Notepad; but for serious work, you need a real IDE or a programmer's
 text editor (vim or emacs, whichever side you're in).

 Always test the you write inside IDLE on a command line.

Thank you both for the replies.  importing tkinter.filedialog did the
trick, and I appreciate the advice about not depending on IDLE.  I'm
not planning on doing any serious work, so I will probably continue to
rely on IDLE for now.
-- 
http://mail.python.org/mailman/listinfo/python-list


hollywood sexiest scenes hollywood blue films hollywood actress hollywood actress wallpapers hollywood actress hot bed scene hollywood actress pictures hollywood actress angelina jolie

2010-04-26 Thread Naeem
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films hollywood actress
hollywood actress wallpapers hollywood actress hot bed scene
hollywood actress pictures hollywood actress angelina jolie ON
http://hollywood6y.blogspot.com/   hollywood sexiest scenes
hollywood blue films hollywood actress hollywood actress
wallpapers hollywood actress hot bed scene hollywood actress
pictures hollywood actress angelina jolie ON  
http://hollywood6y.blogspot.com/
hollywood sexiest scenes hollywood blue films 

[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Added file: http://bugs.python.org/file17085/timemodule-gmtime-r265.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Added file: http://bugs.python.org/file17086/timemodule-gmtime-r27b1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Added file: http://bugs.python.org/file17087/timemodule-gmtime-r312.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Added file: http://bugs.python.org/file17088/timemodule-gmtime-3-trunk.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Removed file: http://bugs.python.org/file16351/timemodule-gmtime-2-trunk.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Removed file: http://bugs.python.org/file16352/timemodule-gmtime-2-r27a3.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Removed file: http://bugs.python.org/file16353/timemodule-gmtime-2-r311.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Changes by Francesco Del Degan f.delde...@ngi.it:


Removed file: http://bugs.python.org/file16354/timemodule-gmtime-2-r264.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-04-26 Thread Francesco Del Degan

Francesco Del Degan f.delde...@ngi.it added the comment:

Fixed typos, new patches added

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6280
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8532] Refinements to Python 3 New GIL

2010-04-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
resolution:  - duplicate
status: open - closed
superseder:  - Convoy effect with I/O bound threads and New GIL

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8532
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

 That's what I thought at first too. But the user's sockets were set to 
 blocking.

That's one broken networking stack...

 In fact, I think it's a little silly that OS X raises the error rather than 
 just saying that 0 bytes were sent (which is what I suppose that other OSes 
 do).

Normal OS just block inside the send() call whenever socket buffers are full 
(unless there're set to non-blocking). So you can resume sending as soon as 
buffer space is available, and you don't have to resort to this 
send()/fail/sleep/re-send() scheme... 

 But I think it's also not ideal that Python's socket.sendall() can't be used 
 with confidence under OS X because it can fail under pretty normal 
 circumstances.

Agreed, but it's really a OS X issue here. How would you circumvent this 
problem anyway ? Add a timeout option to sendall() as a hint to how much we 
should wait before retrying when errno 35 is returned ? It would be really 
hacky...

Maybe the user could try increasing SO_SNDBUF, but this won't necessarily solve 
his problem...

@exarkun: ideas on this ?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7946] Convoy effect with I/O bound threads and New GIL

2010-04-26 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Dave,

 In the current implementation, threads perform a timed-wait on a
 condition variable.  If time expires and no thread switches have
 occurred, the currently running thread is forced to drop the GIL.

A problem, as far as I can see, is that these timeout sleeps run
periodically, regardless of the actual times at which thread switching
takes place. I'm not sure it's really an issue but it's a bit of a
departure from the ideal behaviour of the switching interval.

 A new attribute 'cpu_bound' is added to the PyThreadState structure.
 If a thread is ever forced to drop the GIL, this attribute is simply
 set True (1).  If a thread gives up the GIL voluntarily, it is set
 back to False (0).  This attribute is used to set up simple scheduling
 (described next).

Ok, so it's not very different, at least in principle, from what
gilinter.patch does, right?
(and actually, the benchmark results look very similar)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7946
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 That's what I thought at first too. But the user's sockets were set to 
 blocking.

If you set a timeout on a socket, it is really non-blocking internally (from 
the OS' point of view). So perhaps this is what you are witnessing.

By the way, rather than sleeping a fixed amount of time before retrying, you 
could probably use select() on the socket.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

2010-04-26 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

What is the mnemonic corresponding to errno 35 under OS X?
(under Linux I get EDEADLOCK, which probably isn't the right one)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8493
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4171] SSL handshake fails after TCP connection in getpeername()

2010-04-26 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, so I think we can close the issue then. Thank you!

--
resolution:  - out of date
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4171
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6085] Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

2010-04-26 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Actually, DNS resolution should be disabled by default, as in most HTTP servers 
probably.

--
nosy: +pitrou
stage:  - unit test needed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6085
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8513] subprocess: support bytes program name

2010-04-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

My patch changes:
 * os._execvpe(): support bytes type for the file argument (program name)
 * os.get_exec_path(): support bytes type for the PATH environment variable
 * Popen._execute_child(): decode the executable name before encoding the 
arguments (if the program name is not an absolute path)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8513
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6085] Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

2010-04-26 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

And for this specific request, it fdqn is looked up only for logging to 
sys.stderr. Either removing the fqdn call or just caching per connection it as 
the patch does is both fine. I doubt if someone is relying this logging 
anywhere in the code. This is useful only when BaseHTTPServer is started in the 
command like as a standalone HTTP server.

What shall we do for this? remove the fqdn or cache it once and use it. Either 
is fine. And there is not testing code present (or required too - as this is a 
cli invocation scenario).

--
assignee:  - orsenthil

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6085
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 They're also useful for dealing with environment variables 
 which are not strictly filesystem (fs) related but also suffer 
 from the same issue requiring surrogate escape.

Yes, Python3 decodes environment variables using 
sys.getfilesystemencoding()+surrogateescape. And since my last fix on 
os.execve(), subprocess (and os.execv(p)e) uses also surrogateescape to encode 
environment variables.

And yes again, I also patched os.getenv() to decode bytes name to unicode using 
sys.getfilesystemencoding()+surrogateescape.

 But other than just calling these os.encode and os.decode

*fs*encode() and *fs*decode() is a reference to the encoding: 
sys.get*filesystem*encoding().

 I just wanted to point the other use out

See also issue #8513.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8514
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8214] Add exception logging function to syslog module

2010-04-26 Thread Sean Reifschneider

Sean Reifschneider j...@tummy.com added the comment:

I believe I have the first function implemented.  See the attached patch for 
that code and feel free to review.

--
keywords: +patch
nosy:  -haypo
Added file: http://bugs.python.org/file17089/logexception.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8214
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8533] regrtest: use backslashreplace error handler for stdout

2010-04-26 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

If a test fails, regrtest writes the backtrace to sys.stdout. If the backtrace 
contains a non-ASCII characters, it's encoded using sys.stdout encoding.

In some conditions, sys.stdout is unable to encode some or all non-ASCII 
characters. Eg. if there is no locale set (empty environment or at least empty 
LANG variable value), sys.stdout.encoding=ascii.

If regrtest fails to display a test output (error backtrace), regrtest exits 
directly (don't execute next tests).

I propose to use backslashreplace error handler in sys.stdout, as done for 
sys.stderr to avoid this annoying issue.

Attached patch (for py3k) replace sys.stdout by a new file using 
backslashreplace, just before executing the tests.

I don't know if the issue concerns also Python2.

--
files: regrtest_stdout_backslashreplace.patch
keywords: patch
messages: 104212
nosy: haypo
severity: normal
status: open
title: regrtest: use backslashreplace error handler for stdout
versions: Python 3.1, Python 3.2
Added file: 
http://bugs.python.org/file17090/regrtest_stdout_backslashreplace.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8533
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8533] regrtest: use backslashreplace error handler for stdout

2010-04-26 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
components: +Tests, Unicode

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8533
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6085] Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

2010-04-26 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 And for this specific request, it fdqn is looked up only for logging
 to sys.stderr. Either removing the fqdn call or just caching per
 connection it as the patch does is both fine. I doubt if someone is
 relying this logging anywhere in the code. This is useful only when
 BaseHTTPServer is started in the command like as a standalone HTTP
 server.

I think we should totally remove the call to fqdn. The common practice
with HTTP servers is to log numeric IPs and, if desired, let a batch log
analysis process (such as awstats) deal with DNS resolution and caching.

 And there is not testing code present (or required too - as this is a
 cli invocation scenario).

What do you mean? BaseHTTPRequestHandler is tested in test_httpservers.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6085
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oh! In Python3, ntpath.expanduser() supports bytes path and uses 
sys.getfilesystemencoding() to encode an unicode environment variable to a byte 
string.

Should we remove bytes path support in ntpath.expanduser(), or support bytes in 
ntpath.fsencode()/.fsdecode()?

(sys.getfilesystemencoding() is mbcs on Windows)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8514
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8534] multiprocessing not working from egg

2010-04-26 Thread simon

New submission from simon ext-simon.stei...@nokia.com:

testmultiprocessing.py:

def main():
import multiprocessing

proc = multiprocessing.Process(target=runhi)
proc.start()
proc.join()

def runhi():
print 'hi'

if __name__ == __main__:
main()

testmultiprocessing.py is inside myegg.egg

set PYTHONPATH=myegg.egg

python -m testmultiprocessing

Traceback (most recent call last):
  File string, line 1, in module
  File C:\Python26\lib\multiprocessing\forking.py, line 341, in main
prepare(preparation_data)
  File C:\Python26\lib\multiprocessing\forking.py, line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named testmultiprocessing

--
components: Library (Lib)
messages: 104215
nosy: simonsteiner
severity: normal
status: open
title: multiprocessing not working from egg
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8534
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6085] Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

2010-04-26 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Mon, Apr 26, 2010 at 10:45:56AM +, Antoine Pitrou wrote:

 What do you mean? BaseHTTPRequestHandler is tested in test_httpservers.

I meant specifically for that function which is logging to sys.stderr.
No return values, state changes and no tests present in test_httpservers.
Seems to me the cli invokation scenario of the BaseHTTPServer module.

Only other place where fqdn look up happens is HTTPServer.server_bind
and in the setting of server_name, if any code is relying on it could
break.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6085
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >