samurai-x2 0.1 released

2008-12-23 Thread dunkford...@googlemail.com
Hi,

We are happy to release version 0.1 of samurai-x2. samurai-x2 is a
window manager written in pure python using ctypes, xcb and cairo.

samurai-x2 is a rewrite of samurai-x which used xlib, the new version
uses xcb instead which makes the code simpler and faster. Using xcb
makes samurai-x one of the first window managers to use xcb and using
nothing but python and ctypes makes samurai-x one of the first 'pure
python' window managers available.

For more information, including installation instructions check
http://samurai-x.org.

Big thanks to all have helped out with samurai-x but especially to
Fred Reichbier who has done a lot of work on the new xcb based version
and to Jochen Maes for hosting the project.

Merry Christmas
Dunk Fordyce
--
http://mail.python.org/mailman/listinfo/python-announce-list

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


[ANN] Python 2.5.4 (final)

2008-12-23 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm
happy to announce the release of Python 2.5.4 (final).

Python 2.5.3 unfortunately contained an incorrect patch that could
cause interpreter crashes; the only change in Python 2.5.4 relative
to 2.5.4 is the reversal of this patch.

2.5.4 is the last bug fix release of Python 2.5. Future 2.5.x releases
will only include security fixes. According to the release notes, about
80 bugs and patches have been addressed since Python 2.5.2, many of
them improving the stability of the interpreter, and improving its
portability.

See the release notes at the website (also available as Misc/NEWS in
the source distribution) for details of bugs fixed; most of them prevent
interpreter crashes (and now cause proper Python exceptions in cases
where the interpreter may have crashed before).

For more information on Python 2.5.4, including download
links for various platforms, release notes, and known issues, please
see:

http://www.python.org/2.5.4

Highlights of the previous major Python releases are available
from the Python 2.5 page, at

http://www.python.org/2.5/highlights.html

Enjoy this release,
Martin

Martin v. Loewis
mar...@v.loewis.de
Python Release Manager
(on behalf of the entire python-dev team)
--
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: join a samba domain

2008-12-23 Thread Toff
On 22 déc, 19:37, Toff christophed...@gmail.com wrote:
 On 22 déc, 18:59, Jens Henrik Leonhard Jensen

 j...@statsbiblioteket.dk wrote:
  Toff wrote:
      d = c.Win32_ComputerSystem
      d.JoinDomainOrWorkGroup(None, 3, mydom, mydompw, radmin\\mydom)

  Shouldn't radmin\\mydom be admin\\mydom or radmin\mydom.
  Or maybe just admin

  /Jens Henrik

 you are right but i've got the same error.

the more i look at my script the more i think it s a BUG.

#ALL works great
import wmi
c = wmi.WMI()
for computer in c.Win32_ComputerSystem():
if computer.PartOfDomain:
print computer.Domain #DOMCD
print computer.SystemStartupOptions # (u'Microsoft 
Windows XP
Professionnel /noexecute=optin /fastdetect',)

#error message
computer.JoinDomainOrWorkGroup('DOMCD', 'adminLocal', 
'admin\
\DOMCD',None,3  )


##
DOMCD
(u'Microsoft Windows XP Professionnel /noexecute=optin /
fastdetect',)
Traceback (most recent call last):
  File integrdom.py, line 51, in module
main()
  File integrdom.py, line 13, in main
joindom()
  File integrdom.py, line 47, in joindom
computer.JoinDomainOrWorkGroup('DOMCD', 'adminLocal', 'admin\
\DOMCD',None,3
 )
  File c:\Python25\Lib\site-packages\wmi.py, line 493, in
__getattr__
handle_com_error (error_info)
  File c:\Python25\Lib\site-packages\wmi.py, line 189, in
handle_com_error
raise x_wmi, \n.join (exception_string)
wmi.x_wmi
--
http://mail.python.org/mailman/listinfo/python-list


Re: no sign() function ?

2008-12-23 Thread Arnaud Delobelle
pdora...@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) writes:

 def sign_0(x):
 if x==0.0:
 return 0.0
 elif x0.0:
 return 1.0
 else:
 return -1.0
  

This might be slightly faster:

def sign(x):
return 1 if x  0 else x and -1

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


Re: Python's popularity

2008-12-23 Thread Arnaud Delobelle
s...@pobox.com writes:

  If you look back at the Tour de France results from the 80's I
 believe Greg Lemond won it one year without ever winning a stage.

Well I think it was actually in 1990, his last win sadly.

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


Re: Are Django/Turbogears too specific?

2008-12-23 Thread Bruno Desthuilliers

Daniel Fetchinson a écrit :
(snip)

The 1.x branch of tg is built on cherrypy, the 2.x branch is built on
pylons. Both branches depend on external packages for most of their
functionality which makes them very flexible. Django is monolithic 


Except that
1/ you can use each component (request handler/dispatcher, templating 
system and ORM) standalone, and

2/ you can use any other ORM or templating system.


and was intended to be monolithic.


highly integrated would be more accurate than monolithic IMHO.


Of course you can customize it and use
different components than the defaults, but after all *everything* is
customizable since the source code is there and you can modify it.


You don't need to touch the source to swap ORM or templating system.


The
point is that tg was designed with flexibility and customizability in
mind, while django was designed with a monolithic infrastructure in
mind.


s/monolithic/integrated/

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


Re: Python's popularity

2008-12-23 Thread Bruno Desthuilliers

Steve Holden a écrit :

walterbyrd wrote:
[...] Fooled by version numbers ?

No, but I am giving django the benefit of the doubt. The django
project told people all along that django was not to be considered
production ready before 1.0. I will accept that some people decided to
wait until 1.0 came out to do any production development. Maybe django
is only lagging because 1.0 just came out?


The Django people said no such thing. They maintained the trunk as
stable - they test so well that many people did indeed rely on the trunk
for production systems.


Indeed - my first Django app has been in production for more than 3 
years now.


(snip)



My actual CTO is a big Ruby/Rails fan, yet he settled on Python/Django
for our current 'big' project. Wonder why ?

Not knowing much about RoR: yes, I wonder why? Is it because python
has a cleaner syntax? Or what?


It's because he decided that Django was the best tool for the particular
job, making him unusually open-minded for a member of the pointy-haired
species.


Being a CTO doesn't necessarily makes you pointy-haired !-) We're a 
small shop (12 peoples), and the guy is a developper too (and yes, an 
active one).



Unlike some on this list he doesn't let his prejudices blind
him to reality.


Yes - that was the point.
--
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2008-12-23 Thread sai

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


Re: join a samba domain

2008-12-23 Thread Toff
Or maybe could I try with
LoadLibrary(netapi32.dll);
and the netjoindomain function ?

but it doesn't look very easy 
--
http://mail.python.org/mailman/listinfo/python-list


Re: using subprocess module in Python CGI

2008-12-23 Thread ANURAG BAGARIA
Thank you for the prompt response.

Yeah, I missed out one line at the end of the error, the whole of which is:

Traceback (most recent call last):
  File process.py, line 18, in module
retval = subprocess.call(comd, 0, None, None, outptr, errptr)
  File /usr/lib/python2.5/subprocess.py, line 443, in call
return Popen(*popenargs, **kwargs).wait()
  File /usr/lib/python2.5/subprocess.py, line 593, in __init__
errread, errwrite)
  File /usr/lib/python2.5/subprocess.py, line 1135, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Looking forward to any kind of help or suggestion in this regard.
Thanks.

On Tue, Dec 23, 2008 at 7:00 AM, Chris Rebert c...@rebertia.com wrote:

 On Mon, Dec 22, 2008 at 2:02 AM, ANURAG BAGARIA
 anurag.baga...@gmail.com wrote:
  Hello,
 
  I am a Python Newbie and would like to call a short python script via
  browser using a CGI script, but initially I am trying to call the same
  python script directly through python command line. The script intends to
  perform a few command line in a pipe and I have written the script (a
 short
  one) as follows.
 
  #!/usr/bin/python
 
  import cgi, string, os, sys, cgitb, commands, subprocess
  import posixpath, macpath
  #file = x.tar.gz
  #comd = tar -xf %s % (file)
  #os.system(comd)
  #commands.getoutput('tar -xf x.tar.gz | cd demo; cp README ../')
  comd = [\
  tar -xf x.tar.gz, \
  cd demo, \
  cp README ../, \
]
  outFile = os.path.join(os.curdir, output.log)
  outptr = file(outFile, w)
  errFile = os.path.join(os.curdir, error.log)
  errptr = file(errFile, w)
  retval = subprocess.call(comd, 0, None, None, outptr, errptr)
  errptr.close()
  outptr.close()
  if not retval == 0:
  errptr = file(errFile, r)
  errData = errptr.read()
  errptr.close()
  raise Exception(Error executing command:  + repr(errData))
 
 
  but after trying to execute this independently, I get the following error
  which I am unable to interpret :
 
  Traceback (most recent call last):
File process.py, line 18, in module
  retval = subprocess.call(comd, 0, None, None, outptr, errptr)
File /usr/lib/python2.5/subprocess.py, line 443, in call
  return Popen(*popenargs, **kwargs).wait()
File /usr/lib/python2.5/subprocess.py, line 593, in __init__
  errread, errwrite)
File /usr/lib/python2.5/subprocess.py, line 1135, in _execute_child
  raise child_exception

 There should be at least one more line in this traceback, and that
 line is the most important one.
 People will need that line to help you with your problem.

 Cheers,
 Chris

 --
 Follow the path of the Iguana...
 http://rebertia.com




-- 
I just want to LIVE while I'm alive.


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


Re: join a samba domain

2008-12-23 Thread Tim Golden

Toff wrote:

On 22 déc, 19:37, Toff christophed...@gmail.com wrote:

On 22 déc, 18:59, Jens Henrik Leonhard Jensen

j...@statsbiblioteket.dk wrote:

Toff wrote:

   d = c.Win32_ComputerSystem
   d.JoinDomainOrWorkGroup(None, 3, mydom, mydompw, radmin\\mydom)

Shouldn't radmin\\mydom be admin\\mydom or radmin\mydom.
Or maybe just admin
/Jens Henrik

you are right but i've got the same error.


the more i look at my script the more i think it s a BUG.

#ALL works great
import wmi
c = wmi.WMI()
for computer in c.Win32_ComputerSystem():
if computer.PartOfDomain:
print computer.Domain #DOMCD
print computer.SystemStartupOptions # (u'Microsoft 
Windows XP
Professionnel /noexecute=optin /fastdetect',)

#error message
computer.JoinDomainOrWorkGroup('DOMCD', 'adminLocal', 
'admin\
\DOMCD',None,3  )



Try: computer.JoinDomainOrWorkgroup (...)

note the lowercase group

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


turtle ?

2008-12-23 Thread sai
python newbie here  :-)

I am trying to get turtle to run but got stuck here:

$ python
Python 2.5.2 (r252:60911, Aug  5 2008, 16:17:28)
[GCC 4.2.2 20071128 (prerelease) (4.2.2-3.1mdv2008.0)] on linux2
Type help, copyright, credits or license for more information.
 import turtle
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: No module named turtle

I have used google to search the web and the newsgroup but got
nothing. The Linux distro is Mandriva, if that makes a difference.

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


Re: turtle ?

2008-12-23 Thread Gerhard Häring
sai wrote:
 python newbie here  :-)
 
 I am trying to get turtle to run but got stuck here:
 
 $ python
 Python 2.5.2 (r252:60911, Aug  5 2008, 16:17:28)
 [GCC 4.2.2 20071128 (prerelease) (4.2.2-3.1mdv2008.0)] on linux2
 Type help, copyright, credits or license for more information.
 import turtle
 Traceback (most recent call last):
   File stdin, line 1, in module
 ImportError: No module named turtle
 
 I have used google to search the web and the newsgroup but got
 nothing. The Linux distro is Mandriva, if that makes a difference.

Mandriva have probably split Python into several packages. If so,
chances are one of them contains the tkinter GUI library. You should
look in your package management tool for a package called
python-tkinter, python-tk or similar and install it.

HTH

Gerhard

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


Re: Beep

2008-12-23 Thread Jeremiah Dodds
On Mon, Dec 22, 2008 at 10:42 PM, Jeffrey Barish
jeff_bar...@earthlink.netwrote:



 On Ubuntu, it is possible to set visual and audible beeps separately.  When
 I set both, I get the visual beep, but not the audible one.  It's not a
 Python issue -- so I should take this thread to Ubuntu -- because I observe
 this behavior even when I hit backspace at the beginning of a line in a
 terminal.
 --
 Jeffrey Barish

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


Well, I would try printing a bell character in another language, say ruby or
perl, or just in the terminals on the machines that won't print them in
python. If you get a bell from those, it's likely some issue with your
python installation, otherwise it's likely a problem with Ubuntu
configuration somewhere.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-23 Thread Hendrik van Rooyen
r rt8...@gmail.com wrote:

Now thats the kind of friendly banter this group could use. Instead of
people acting as if their bowel-movements smell like bakery fresh
cinnamon rolls!

What an amazing thing to say!

Doesn't yours?

- Hendrik

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


Re: Python's popularity

2008-12-23 Thread Hendrik van Rooyen
 r rt8...@gmail.com wrote::

 The writing is on the Wall!

Yes it is, and as always, it says :

Mene, mene, tekel epharsim.

If my protestant upbringing hasn't failed me,
it means:

Weighed, and found wanting.

- Hendrik



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


Re: Python's popularity

2008-12-23 Thread Aaron Brady
On Dec 23, 2:33 am, Hendrik van Rooyen m...@microcorp.co.za wrote:
 r rt8...@gmail.com wrote:
 Now thats the kind of friendly banter this group could use. Instead of
 people acting as if their bowel-movements smell like bakery fresh
 cinnamon rolls!

 What an amazing thing to say!

 Doesn't yours?

 - Hendrik

rerunYou think your ships don't sink?/rerun
--
http://mail.python.org/mailman/listinfo/python-list


Very basic question

2008-12-23 Thread Sengly
Hello all,

I would like to calculate a string expression to a float. For example,
I have ('12/5') and I want 2.4 as a result. I tried to use eval but it
only gives me 2 instead of 2.5

Help!!!

Regards,

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


Re: Very basic question

2008-12-23 Thread Sengly
I can hack it by doing eval('1.0*12/5') but is there any better method?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Very basic question

2008-12-23 Thread Aaron Brady
On Dec 23, 4:46 am, Sengly sengly.h...@gmail.com wrote:
 Hello all,

 I would like to calculate a string expression to a float. For example,
 I have ('12/5') and I want 2.4 as a result. I tried to use eval but it
 only gives me 2 instead of 2.5

 Help!!!

 Regards,

 Sengly

 float('12')/float('5')
2.3999
 print float('12')/float('5')
2.4
 float(12/5)
2.0
 print float(12/5)
2.0
--
http://mail.python.org/mailman/listinfo/python-list


wxPython.button.disabled still catching clicks

2008-12-23 Thread mynthon
Hello! (sorry for my english)

I have a problem with buttons in wxPython. When button is disabled
(by .Disable() or .Enable(False)) it is grayed out but still receive
clicks.

Eg. i have button that disable itself, runs long action and enable
itself:

def onClick(self, evt):
self.btn.Enable(False)
for i in range (1000):
print i
self.btn.Enable(True)

when for loop is running button is greyed out and when i click on it
nothing happens but when loop ends another one is started because
button remebered thad i click on it when was diabled. My only idea
is to reposition button outside frame instead of disabling it but this
solution is...not good.

thanks for any help. Ive searched groups, google and it looks that
only i have this problem :)
--
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython.button.disabled still catching clicks

2008-12-23 Thread Aaron Brady
On Dec 23, 4:50 am, mynthon mynth...@gmail.com wrote:
 Hello! (sorry for my english)

 I have a problem with buttons in wxPython. When button is disabled
 (by .Disable() or .Enable(False)) it is grayed out but still receive
 clicks.

 Eg. i have button that disable itself, runs long action and enable
 itself:

 def onClick(self, evt):
     self.btn.Enable(False)
     for i in range (1000):
         print i
     self.btn.Enable(True)

 when for loop is running button is greyed out and when i click on it
 nothing happens but when loop ends another one is started because
 button remebered thad i click on it when was diabled. My only idea
 is to reposition button outside frame instead of disabling it but this
 solution is...not good.

 thanks for any help. Ive searched groups, google and it looks that
 only i have this problem :)

No, it is very common.  During your for loop, the loop is dominating
the process completely.  Events are just building up in the app's
message queue, and don't get handled until after you yield on control.

If you need to run a long task, look into threading, the OnIdle
method, the 'multiprocessing' module, or pump messages during your
long task.
--
http://mail.python.org/mailman/listinfo/python-list


print to console without a line break

2008-12-23 Thread Qian Xu
Hello All,

Is it possible to print something to console without a line break?

I tried:
  sys.stdout.write(Testing something ...) // nothing will be printed
  time.sleep(1)
  sys.stdout.write(done\n) // now, the whole string will be printed

What I want, is to see Testing something ... first. 
And after 1 second, to see done (with a line break)

The only one solution I have found is to call echo -n 'my_string'.
But it is not nice. Because I have to escape all special chars in the string
manually.

Any advice?
Best regards
-- Qian Xu
--
http://mail.python.org/mailman/listinfo/python-list


Re: print to console without a line break

2008-12-23 Thread Qian Xu
Qian Xu wrote:

 Hello All,
 
 Is it possible to print something to console without a line break?
 
 I tried:
   sys.stdout.write(Testing something ...) // nothing will be printed
   time.sleep(1)
   sys.stdout.write(done\n) // now, the whole string will be printed
 
 What I want, is to see Testing something ... first.
 And after 1 second, to see done (with a line break)
 

I have solved the problem by calling
  sys.stdout.flush()

--Qian Xu


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


Re: Very basic question

2008-12-23 Thread John Machin
On Dec 23, 9:49 pm, Sengly sengly.h...@gmail.com wrote:
 I can hack it by doing eval('1.0*12/5') but is there any better method?

from __future__ import division
--
http://mail.python.org/mailman/listinfo/python-list


Re: Very basic question

2008-12-23 Thread Sion Arrowsmith
Sengly  sengly.h...@gmail.com wrote:
I would like to calculate a string expression to a float. For example,
I have ('12/5') and I want 2.4 as a result. I tried to use eval but it
only gives me 2 instead of 2.5

py from __future__ import division
py print eval('12/5')
2.4
py print eval('12//5')
2

Or switch to 3.0 which gives you this behaviour without the __future__
import.

-- 
\S -- si...@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
   Frankly I have no feelings towards penguins one way or the other
-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
--
http://mail.python.org/mailman/listinfo/python-list


Re: Very basic question

2008-12-23 Thread Bryan Olson

Sengly wrote:

I can hack it by doing eval('1.0*12/5') but is there any better method?


Where did you get the string? If you generated it, you might as well 
make one or both the operands float to begin with. If you got it as 
input, calling eval() on it is a world of security hurt.


The right way would be to parse the expression, so you can evaluate it 
as you wish.


Security defects aside, just prepending '1.0 *' doesn't work in general, 
because the string could be something like '5 + 12 / 5'. If you replace 
each '/' that isn't immediately followed by another '/' with '* 1.0 /', 
that might work... or maybe someone fill find counter-examples.


Python 3 does what you want. The / operator is float division. The // 
operator is still integer division.



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


Re: String Format Error.

2008-12-23 Thread Steve Holden
Chris Rebert wrote:
 On Mon, Dec 22, 2008 at 10:19 PM, Paulo Repreza pxrepr...@gmail.com wrote:
 Hi,

 I'm a newbie with python and I recently bought Beginning with Python (Which
 is a book I recommend) but the problem that I'm facing it's the following:

 This is the code:

 #!/usr/bin/python2.5
 # Filename: str_format.py

 age = 25
 name = 'foobar'

 print('{0} is {1} years old'.format(name, age))
 print('Why is {0} playing with that python?'.format(name))


 But when I run the script I receive this error:

 Traceback (most recent call last):
   File str_format.py, line 7, in module
 print('{0} is {1} years old'.format(name, age))
 AttributeError: 'str' object has no attribute 'format'


 It is an error because of the version that I'm using ? Python 2.5.2 (Debian
 lenny)
 
 Yes, Python 2.6 or higher is required to use .format() according to
 http://docs.python.org/whatsnew/2.6.html
 
For a replacement that will work in 2.5, see the % sign as an operator
(sometimes called string interpolation).

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Why MyHDL?

2008-12-23 Thread Jan Decaluwe

Hello:

MyHDL is a Python package for using Python as a
Hardware Description Language.

A new release is upcoming, and on this occasion
we have prepared a page about why MyHDL may
be useful to you:

http://www.myhdl.org/doku.php/why

Regards,

Jan

--
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
Python as a hardware description language:
http://www.myhdl.org

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


Re: Very basic question

2008-12-23 Thread Sengly
Thank you very much everyone.

Regards,

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


On Whose Desktop

2008-12-23 Thread Steve Holden
Thanks to Barry Warsaw the On Your Desktop blog now has a new entry:

  http://onyourdesktop.blogspot.com/

Who would you like to see profiled next?

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: On Whose Desktop

2008-12-23 Thread Fuzzyman
On Dec 23, 12:06 pm, Steve Holden st...@holdenweb.com wrote:
 Thanks to Barry Warsaw the On Your Desktop blog now has a new entry:

  http://onyourdesktop.blogspot.com/

 Who would you like to see profiled next?

 regards
  Steve
 --
 Steve Holden        +1 571 484 6266   +1 800 494 3119
 Holden Web LLC              http://www.holdenweb.com/

Guido (of course), Brett Cannon, Martin v Loewis, Jim Hugunin, Ted
Leung, Dino Viehland (core developer of IronPython), Titus Brown, Ivan
Kristic, Mark Shuttleworth, Tim Golden, Michele Simionato, Thomas
Heller, Greg Ewing - any and all of these would be great.

Any women in Python you could ask - how about Anna Ravenscroft?

Conspicuously missing from the ones you have already done is Steve
Holden of course...

All the best,

Michael Foord
--
http://www.ironpythoninaction.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: On Whose Desktop

2008-12-23 Thread Bruno Desthuilliers

Steve Holden a écrit :

Thanks to Barry Warsaw the On Your Desktop blog now has a new entry:

  http://onyourdesktop.blogspot.com/

Who would you like to see profiled next?


The effbot ?


regards
 Steve

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


Re: Why MyHDL?

2008-12-23 Thread Stef Mientki

hello Jan,

Jan Decaluwe wrote:

Hello:

MyHDL is a Python package for using Python as a
Hardware Description Language.

A new release is upcoming, and on this occasion
we have prepared a page about why MyHDL may
be useful to you:

http://www.myhdl.org/doku.php/why


Very Interesting,
I'm no expert at all (but as an exercise I'm just now writing an EDIF-v2 
to SystemC converter in Python) ,

I wonder why I only see comparison with VHDL and SystemVerilog,
and not with SystemC ?

thanks,
Stef

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


SuSE11.1 eclipse 64 pydev can't add python path

2008-12-23 Thread Reimar Bauer
Hi

I can install pydev using the update manager in eclipse for 64 bit from the
SuSE 11.1 repo. But I can't configure pydev without crashing it.
I can select the interpreter /usr/bin/python
and I do see the System PYTHONPATH
Forced builtin libs also looks good.

But Apply gives me
#
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x7f2d7abebaed, pid=6544, tid=139832007596368
#
# Java VM: IcedTea 64-Bit Server VM (1.7.0-b24 mixed mode linux-amd64)
# Problematic frame:
# V [libjvm.so+0x21baed]
#
# An error report file with more information is saved as:
# /home/user/hs_err_pid6544.log
#
# If you would like to submit a bug report, please visit:
# http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.


That problem happens also with the recent
eclipse-cpp-ganymede-SR1-linux-gtk-x86_64.tar.gz

What can be the cause for this problem? Do you know a workaround e.g.
manually configuring pydev?

Does one have pydev or eclipse working on SuSE11.1?


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


Re: print to console without a line break

2008-12-23 Thread Lie Ryan
On Tue, 23 Dec 2008 11:50:59 +0100, Qian Xu wrote:

 Hello All,
 
 Is it possible to print something to console without a line break?
 
 I tried:
   sys.stdout.write(Testing something ...) // nothing will be printed
   time.sleep(1)
   sys.stdout.write(done\n) // now, the whole string will be printed
 
 What I want, is to see Testing something ... first. And after 1
 second, to see done (with a line break)
 
 The only one solution I have found is to call echo -n 'my_string'. But
 it is not nice. Because I have to escape all special chars in the string
 manually.
 
 Any advice?
 Best regards
 -- Qian Xu

If you don't mind an extra space, you can use this:

print 'Testing something ...', 
# note the trailing comma

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


Re: wxPython.button.disabled still catching clicks

2008-12-23 Thread mynthon
On Dec 23, 11:58 am, Aaron Brady castiro...@gmail.com wrote:
 On Dec 23, 4:50 am, mynthon mynth...@gmail.com wrote:



  Hello! (sorry for my english)

  I have a problem with buttons in wxPython. When button is disabled
  (by .Disable() or .Enable(False)) it is grayed out but still receive
  clicks.

  Eg. i have button that disable itself, runs long action and enable
  itself:

  def onClick(self, evt):
      self.btn.Enable(False)
      for i in range (1000):
          print i
      self.btn.Enable(True)

  when for loop is running button is greyed out and when i click on it
  nothing happens but when loop ends another one is started because
  button remebered thad i click on it when was diabled. My only idea
  is to reposition button outside frame instead of disabling it but this
  solution is...not good.

  thanks for any help. Ive searched groups, google and it looks that
  only i have this problem :)

 No, it is very common.  During your for loop, the loop is dominating
 the process completely.  Events are just building up in the app's
 message queue, and don't get handled until after you yield on control.

 If you need to run a long task, look into threading, the OnIdle
 method, the 'multiprocessing' module, or pump messages during your
 long task.


ok, maybe someone will need it. I dont know how it works because i
didnt have time to read docs and i cannot explain everything. I used
google and wxPython demo (in tree: wxpython overview / process and
events / process)


class leftPanel(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id, style=wx.BORDER_SUNKEN)

# here you have to define new process, IDLE event, and
onPRocessEnd event
self.process = None
self.GetParent().Bind(wx.EVT_IDLE, self.onIdle)
self.Bind(wx.EVT_END_PROCESS, self.onProcessEnd)

# create button and bind event to it
self.runScriptBtn = wx.Button(self, -1, 'RUN ME!', (10,220))
self.runScriptBtn.Bind(wx.EVT_BUTTON, self.onClick,
self.runScriptBtn)


def onClick(self, evt):
# disable button
self.runScriptBtn.Enable(False)

# here you have to enter command to run
# previusly i heve here exec('python myScript.py')
# but now it will be a subprocess
cmd = 'python xxx1.py'

#create new process
self.process = wx.Process(self)

# dont know what it is for
self.process.Redirect()

# execute cmd command
pid = wx.Execute(cmd, wx.EXEC_ASYNC, self.process)


def onIdle(self, evt):
# beacuse this method is called only when app enters idle mode
# the line below is nedded to simulate entering idle mode
# dont know how it works but it works
evt.RequestMore(True)

# here is some code to catch subprocess output
if self.process is not None:
stream = self.process.GetInputStream()
if stream.CanRead():
text = stream.read()
print text


def onProcessEnd(self, evt):
# here is some code to catch subprocess output
# when it is destroyed
stream = self.process.GetInputStream()
if stream.CanRead():
text = stream.read()
print text

# dont know it is necessary
self.process.CloseOutput()

# remove (clear) process object
self.process.Destroy()
self.process = None

# show button again
self.runScriptBtn.Enable()
--
http://mail.python.org/mailman/listinfo/python-list


Re: Are python objects thread-safe?

2008-12-23 Thread Duncan Booth
Aaron Brady castiro...@gmail.com wrote:

 Th.1   Th.2
 a=X
a=Y
 a=Z
 
 You are saying that if 'a=Z' interrupts 'a=Y' at the wrong time, the
 destructor for 'X' or 'Y' might not get called.  Correct?  In serial
 flow, the destructor for X is called, then Y.

No, the destructors will be called, but the destructors can do pretty much 
anything they want so you can't say the assignment is atomic. This isn't 
actually a threading issue: you don't need multiple threads to experience 
werid issues here. If you do strange things in a destructor then you can 
come up with confusing code even with a single thread.

 
 Other nasty things can happen if you use dictionaries from multiple
 threads. You cannot add or remove a dictionary key while iterating over
 a dictionary. This isn't normally a big issue, but as soon as you try to
 share the dictionary between threads you'll have to be careful never to
 iterate through it.
 
 These aren't documented, IIRC.  Did you just discover them by trial
 and error?
 
It is documented, but I can't remember where for Python 2.x. For Python 3, 
PEP 3106 says: As in Python 2.x, mutating a dict while iterating over it 
using an iterator has an undefined effect and will in most cases raise a 
RuntimeError exception. (This is similar to the guarantees made by the Java 
Collections Framework.)


-- 
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: no sign() function ?

2008-12-23 Thread Pierre-Alain Dorange
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:

 But this is just duplicating what timeit already does. Trust me, learn to
 use it, you won't be sorry. Here's a trick that took me a long time to
 learn: instead of copying your functions into the setup code of timeit,
 you can just import them.

Thanks for the advise, i made the test using timeit and your very
interesting method to import... Now i know how to use timeit simply ;-)

New results on 1000 float values randomized from -500.0 to +500.0.
Each test is timeit(1000)

sign_0 : 0.375
sign_1 : 0.444 (+18%)
sign_2 : 0.661 (+76%)
sign_3 : 0.498 (+33%)

It seems it don't change the relative results between the methods.
Using timeit make measure accurate and remove print/range footprints.

I also try Arnaud's proposition, it make sign_0 just a little better
(-1%)

-- 
Pierre-Alain Dorangehttp://microwar.sourceforge.net/

Ce message est sous licence Creative Commons by-nc-sa-2.0
http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
--
http://mail.python.org/mailman/listinfo/python-list


pseudo terminal usage from Python?

2008-12-23 Thread skip

I ran into an interesting problem yesterday.  The mpstat(1) command on
Solaris formats its output like so:

  CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
0   42   1 1184   812  265  227   12   44   370  11316   2   0  93
1   25   1  933   4472  203   37   75   120   9025   4   0  91
2   17   0  195   4951  201   41   77   130   5145   1   0  94
34   0  117   882  405  171   34   65   210   4495   2   0  93

I'm only interested in presenting the CPU numbers and user+sys values
prefixed by a timestamp.  For example, the above might be formatted like so:

07:28:46.373328 0 8 1 9 2 6 3 7

The obvious solution might be something simple like this:

mpstat 1 | python mympstat.py

where mympstat.py does a trival amount of reformatting.

The problem is that mpstat recognizes when its output is a pipe and block
buffers it so the Python script sees input in massive blobs, not the
second-by-second output you'd see running mpstat 1 by itself.  I've been
reduced to a much more complicated solution which involves forking mpstat
with output to a file, then reading the end of that file every second.  A
three-line Python script balloons into a one-page script.  Yuck.  Add to
that I'm writing this for an admin who is considering Python as a scripting
language.   Double Yuck.  (But not nyuk nyuk, this is not the Stooges.)

I suspect there is some magic I can perform with pseudo terminals (this is
on Solaris 10.)  The documentation for the pty module contains no examples
and I've been so far unable to find any using Google.

Any pointers/examples?  I will gladly add an example to the pty module docs
(I have the power!) once I have a couple working examples (maybe one example
each of reading and writing?)

Thanks,

-- 
Skip Montanaro - s...@pobox.com - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: SuSE11.1 eclipse 64 pydev can't add python path

2008-12-23 Thread Benjamin Kaplan
On Tue, Dec 23, 2008 at 7:49 AM, Reimar Bauer r.ba...@fz-juelich.de wrote:

 Hi

 I can install pydev using the update manager in eclipse for 64 bit from the
 SuSE 11.1 repo. But I can't configure pydev without crashing it.
 I can select the interpreter /usr/bin/python
 and I do see the System PYTHONPATH
 Forced builtin libs also looks good.

 But Apply gives me
 #
 # An unexpected error has been detected by Java Runtime Environment:
 #
 # SIGSEGV (0xb) at pc=0x7f2d7abebaed, pid=6544, tid=139832007596368
 #
 # Java VM: IcedTea 64-Bit Server VM (1.7.0-b24 mixed mode linux-amd64)
 # Problematic frame:
 # V [libjvm.so+0x21baed]
 #
 # An error report file with more information is saved as:
 # /home/user/hs_err_pid6544.log
 #
 # If you would like to submit a bug report, please visit:
 # http://icedtea.classpath.org/bugzilla
 # The crash happened outside the Java Virtual Machine in native code.
 # See problematic frame for where to report the bug.


 That problem happens also with the recent
 eclipse-cpp-ganymede-SR1-linux-gtk-x86_64.tar.gz

 What can be the cause for this problem? Do you know a workaround e.g.
 manually configuring pydev?

 Does one have pydev or eclipse working on SuSE11.1?


 cheers
 Reimar


This isn't a problem with PyDev. This is a known bug in the 64-bit Java,
both Sun and OpenJDK. It was fixed in the really recent updates (Sun 6u10
and OpenJDK 6b12, I think), which I guess SuSE doesn't have yet.


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

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


PIL - font kerning

2008-12-23 Thread carsn
Hey all,

anybody know, if there´s a way to specify the kerning of a font, when
you draw text with PIL?

I´d like to achieve the same effect that you get, when you set a
negative kerning in Gimp/Photshop - ie. reduce the spacing between
glyphs.

Can PIL do that or do I use another lib for that?

Thx for any pointers  some nice xmas days to U all!
carsten
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-23 Thread Lie Ryan
On Mon, 22 Dec 2008 21:05:22 -0800, r wrote:

 On Dec 22, 10:09 pm, Ben Kaplan bs...@case.edu wrote:
 That's just because most of us don't say anything unless we have
 something useful to say. We prefer to let the experts answer the
 questions, but we read the threads so we can benefit from them.
 
 OK Ben, So you are saying
 
 1.) do not question the gods!

Hmmm... when we talk about something we don't know, only trash would come 
out of our mouth.

 2.) speak only when spoken to!

He (Ben) does not say anything remotely like that. 

 3.) do not have an opinion!

Again, you're adding sauce, meat, beef, and spices to his statement.

 Somehow this reminds me of some old and brainwashing religions, Not an
 OSS project. Just observations Ben.

Isn't it you that have been accused of religionizing python by many 
people in this list?

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


Re: On Whose Desktop

2008-12-23 Thread Steve Holden
Fuzzyman wrote:
 On Dec 23, 12:06 pm, Steve Holden st...@holdenweb.com wrote:
 Thanks to Barry Warsaw the On Your Desktop blog now has a new entry:

  http://onyourdesktop.blogspot.com/

 Who would you like to see profiled next?

 Guido (of course), Brett Cannon, Martin v Loewis, Jim Hugunin, Ted
 Leung, Dino Viehland (core developer of IronPython), Titus Brown, Ivan
 Kristic, Mark Shuttleworth, Tim Golden, Michele Simionato, Thomas
 Heller, Greg Ewing - any and all of these would be great.

 Any women in Python you could ask - how about Anna Ravenscroft?
 Bruno Desthuilliers wrote:
 
 The effbot ?
 
s...@pobox.com wrote:
 Maybe Martin v. Loewis?  He contributes so much to Python.  I met him once
 several years ago at a Python conference (or maybe it was still just a
 workshop then), but beyond seeing his titanic contributions to Python, I
 know little about the guy.

I hope *everyone* knows that Martin was the winner of this year's Frank
Willison Award:

http://www.python.org/community/awards/frank-willison/#martin-von-l-wis-2008

Great! Keep the suggestions coming, please!

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: Python's popularity

2008-12-23 Thread Thorsten Kampe
* r (Mon, 22 Dec 2008 10:44:32 -0800 (PST)) 
 Steve Holden
  What makes you assume this is a zero-sum game, and that Python won't
  survive if any other language becomes popular. Every language borrows
  from those that came before it. Terms like outright plagiarism don't
  encourage rational debate, and make you seem like a troll who is more
  interested in stirring up controversy than actually doing things to help
  promote the language.
 
 This is a war Steve, and i will explain why. Python does not need to
 compete with perl, lisp, C, basic, etc, etc. WHY, well because python
 is SO radically different than those languages. Ruby on the other
 hand, took most from python, the only difference is Ruby's full OO
 integration.(12.method()). Since Ruby is so similar to python [...]

You don't have a single clue about neither Python nor Ruby:
'According to the Ruby FAQ, If you like Perl, you will like Ruby and be 
right at home with its syntax. [...] If you like Python, you may or may 
not be put off by the huge difference in design philosophy between 
Python and Ruby/Perl.'[1]

Thorsten
[1] http://en.wikipedia.org/wiki/Ruby_(programming_language)#Semantics
--
http://mail.python.org/mailman/listinfo/python-list


Re: iterating initalizations

2008-12-23 Thread D'Arcy J.M. Cain
On Mon, 22 Dec 2008 22:32:17 -0500
Aaron Stepp stepp.aa...@gmail.com wrote:
 Instead of writing a long list of initializations like so:
 
 A = [ ]
 B = [ ]
 ...
 Y = [ ]
 Z = [ ]
 
 I'd like to save space by more elegantly turning this into a loop.  If  

Well, if all you want is a loop:

for v in vars:
locals()[v] = []

It's hard to tell if that's what you actually need though without
deeper analysis of your requirements.

-- 
D'Arcy J.M. Cain da...@druid.net |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-23 Thread Benjamin Kaplan
On Tue, Dec 23, 2008 at 12:05 AM, r rt8...@gmail.com wrote:

 On Dec 22, 10:09 pm, Ben Kaplan bs...@case.edu wrote:
  That's just because most of us don't say anything unless we have
  something useful to say. We prefer to let the experts answer the
  questions, but we read the threads so we can benefit from them.

 OK Ben, So you are saying

 1.) do not question the gods!
 2.) speak only when spoken to!
 3.) do not have an opinion!

 Somehow this reminds me of some old and brainwashing religions, Not an
 OSS project. Just observations Ben.



You're the one who keeps bringing up the need to spread python. For most
people, this is a forum to ask questions and have experts respond to them.
Most people who post here aren't looking for your opinion, they want
answers. If you know the answer to a question, answer it. If not, read the
answers of people who have seen it before. When you post your opinions,
you're just creating more noise.


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

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


Re: pseudo terminal usage from Python?

2008-12-23 Thread Steve Holden
s...@pobox.com wrote:
 I ran into an interesting problem yesterday.  The mpstat(1) command on
 Solaris formats its output like so:
 
   CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
 0   42   1 1184   812  265  227   12   44   370  11316   2   0  93
 1   25   1  933   4472  203   37   75   120   9025   4   0  91
 2   17   0  195   4951  201   41   77   130   5145   1   0  94
 34   0  117   882  405  171   34   65   210   4495   2   0  93
 
 I'm only interested in presenting the CPU numbers and user+sys values
 prefixed by a timestamp.  For example, the above might be formatted like so:
 
 07:28:46.373328 0 8 1 9 2 6 3 7
 
 The obvious solution might be something simple like this:
 
 mpstat 1 | python mympstat.py
 
 where mympstat.py does a trival amount of reformatting.
 
 The problem is that mpstat recognizes when its output is a pipe and block
 buffers it so the Python script sees input in massive blobs, not the
 second-by-second output you'd see running mpstat 1 by itself.  I've been
 reduced to a much more complicated solution which involves forking mpstat
 with output to a file, then reading the end of that file every second.  A
 three-line Python script balloons into a one-page script.  Yuck.  Add to
 that I'm writing this for an admin who is considering Python as a scripting
 language.   Double Yuck.  (But not nyuk nyuk, this is not the Stooges.)
 
 I suspect there is some magic I can perform with pseudo terminals (this is
 on Solaris 10.)  The documentation for the pty module contains no examples
 and I've been so far unable to find any using Google.
 
 Any pointers/examples?  I will gladly add an example to the pty module docs
 (I have the power!) once I have a couple working examples (maybe one example
 each of reading and writing?)
 
Look at the pexpect module - you can run interactive tasks through that.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: print to console without a line break

2008-12-23 Thread Albert Hopkins
On Tue, 2008-12-23 at 13:18 +, Lie Ryan wrote:
 On Tue, 23 Dec 2008 11:50:59 +0100, Qian Xu wrote:
 
  Hello All,
  
  Is it possible to print something to console without a line break?
  
  I tried:
sys.stdout.write(Testing something ...) // nothing will be printed
time.sleep(1)
sys.stdout.write(done\n) // now, the whole string will be printed
  

Probably because your stdout is line-buffered. Try:

sys.stdout.write(Testing something...)
sys.stout.flush() # flush the stdout buffer





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


Re: python3 urlopen(...).read() returns bytes

2008-12-23 Thread Christian Heimes
ajaksu wrote:
 On Dec 22, 9:05 pm, Christian Heimes li...@cheimes.de wrote:
 ajaksu schrieb:

 That said, a decode to declared HTTP header encoding version of
 urlopen could be useful to give some users the output they want (text
 from network io) or to make it clear why bytes is the safe way.
 Yeah, your idea sounds both useful and feasible. A patch is welcome! :)
 
 Would monkeypatching what urlopen returns be good enough or should we
 aim at a cleaner implementation?

If you want to do it right ... It should be a clean patch against the
py3k svn branch including documentation and a unit test. Don't worry!
It's not as hard as it sounds. Besides Python core development is fun. :)

Christian

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


Re: no sign() function ?

2008-12-23 Thread Christian Heimes
All algorithm including my own suffer from one mistake. Nobody accounts
for NaN (not a number). You have to check for NaNs, too. NaNs have no
sign at all.

You could also try to do some fancy bit mask operation like

 ord(struct.pack(d, 0.)[7])  0x80
0
 ord(struct.pack(d, -0.)[7])  0x80
128

But you have to take care of little endian, big endian and mixd endian
IEEE 754 platforms, too. There are also platforms that don't have IEEE
754 floats at all ... Have fun :)

Christian

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


Re: print to console without a line break

2008-12-23 Thread Qian Xu
Albert Hopkins wrote:

 On Tue, 2008-12-23 at 13:18 +, Lie Ryan wrote:
 
 Probably because your stdout is line-buffered. Try:
 
 sys.stdout.write(Testing something...)
 sys.stout.flush() # flush the stdout buffer

Thanks. This works for me ^^)
--
http://mail.python.org/mailman/listinfo/python-list


Re: print to console without a line break

2008-12-23 Thread Qian Xu
Lie Ryan wrote:
 
 If you don't mind an extra space, you can use this:
 
 print 'Testing something ...',
 # note the trailing comma

Thanks. However, the contents will be saved in buffer and will not be shown
until print (last piece)

sys.stdout.flush() can solve this problem :-)
--
http://mail.python.org/mailman/listinfo/python-list


Re: iterating initalizations

2008-12-23 Thread Steve Holden
D'Arcy J.M. Cain wrote:
 On Mon, 22 Dec 2008 22:32:17 -0500
 Aaron Stepp stepp.aa...@gmail.com wrote:
 Instead of writing a long list of initializations like so:

 A = [ ]
 B = [ ]
 ...
 Y = [ ]
 Z = [ ]

 I'd like to save space by more elegantly turning this into a loop.  If  
 
 Well, if all you want is a loop:
 
 for v in vars:
 locals()[v] = []
 
Note that this isn't guaranteed to work. While locals() will return a
dict containing the names and values from the local namespace, you won't
affect the local namespace by assigning values to the appropriate keys:

 def f():
...   a = hello
...   locals()[a] = goodbye
...   print a
...
 f()
hello


If you look at the function's code you will see that the local a is
accessed using the LOAD_FAST and STORE_FAST opcodes, which take
advantage of the knowledge that the name is local - the interpreter
analyzed the function body looking for assignments to non-globals, and
optimizes its treatment of such names.

 dis.dis(f)
  2   0 LOAD_CONST   1 ('hello')
  3 STORE_FAST   0 (a)

  3   6 LOAD_CONST   2 ('goodbye')
  9 LOAD_GLOBAL  0 (locals)
 12 CALL_FUNCTION0
 15 LOAD_CONST   3 ('a')
 18 STORE_SUBSCR

  4  19 LOAD_FAST0 (a)
 22 PRINT_ITEM
 23 PRINT_NEWLINE
 24 LOAD_CONST   0 (None)
 27 RETURN_VALUE


 It's hard to tell if that's what you actually need though without
 deeper analysis of your requirements.
 
I think it's unlikely that the OP really does need to create names
dynamically, and should look at using either a dict indexed by the
letters of self.__abet, or a list indexed from 0 to 24 instead. But you
*are* correct about the need for a little more information ;-)

regards
 Steve


-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: pseudo terminal usage from Python?

2008-12-23 Thread skip
Steve Look at the pexpect module - you can run interactive tasks
Steve through that.

Thanks.  Worked like a charm.

-- 
Skip Montanaro - s...@pobox.com - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: iterating initalizations

2008-12-23 Thread Aaron Stepp

import random
from rtcmix import *
from chimes_source import * # Chime.play()
from rhythmblock import * # rhythmBlock.rhythmTwist() and  
rhythmBlock.printStuff()
from pitchblock import * # pitchBlock.pitchTwist() and  
pitchBlock.printStuff()

from lenEval import *  #greaterThan.sovler()

indexrand = random.Random()
indexrand.seed(2)

chime = Chime()
notes = pitchBlock()
rhythm = rhythmBlock()
solve = greaterThan()

class arrayBlock:

def __init__(self, theTempo, start):
self.__A = []
self.__B = []
self.__start = start
self.__tempo = theTempo

def player(self, length, tempo, octave, pan, seed):

tempo = (120, self.__tempo)

for a in range(length):

one = indexrand.randint(0, 3)

two = indexrand.randint(0, 7)

self.__A = self.__A + notes.pitchTwist(one , two)

for b in range(length):

one = indexrand.randint(0, 3)

two = indexrand.randint(0, 7)

self.__B = self.__B + rhythm.rhythmTwist(one , two)

lenA = len(self.__A)
lenB = len(self.__B)

var = solve.solver(lenA, lenB)


for c in range(var):

print self.__A[c]

self.__start = self.__start + tb(self.__B[var])

chime.play(self.__start, self.__A[var], octave, pan, 
seed)

This almost does exactly what I want, and is far cleaner than my  
previous attempts.


The only problem is that now all my arguments are being passed as zeros!

I assume this has to do with WHEN I'm referencing self.__A and self.__B?

AS


On Dec 23, 2008, at 10:20 AM, Steve Holden wrote:


D'Arcy J.M. Cain wrote:

On Mon, 22 Dec 2008 22:32:17 -0500
Aaron Stepp stepp.aa...@gmail.com wrote:

Instead of writing a long list of initializations like so:

A = [ ]
B = [ ]
...
Y = [ ]
Z = [ ]

I'd like to save space by more elegantly turning this into a  
loop.  If


Well, if all you want is a loop:

   for v in vars:
   locals()[v] = []


Note that this isn't guaranteed to work. While locals() will return a
dict containing the names and values from the local namespace, you  
won't
affect the local namespace by assigning values to the appropriate  
keys:



def f():

...   a = hello
...   locals()[a] = goodbye
...   print a
...

f()

hello




If you look at the function's code you will see that the local a is
accessed using the LOAD_FAST and STORE_FAST opcodes, which take
advantage of the knowledge that the name is local - the interpreter
analyzed the function body looking for assignments to non-globals, and
optimizes its treatment of such names.


dis.dis(f)

 2   0 LOAD_CONST   1 ('hello')
 3 STORE_FAST   0 (a)

 3   6 LOAD_CONST   2 ('goodbye')
 9 LOAD_GLOBAL  0 (locals)
12 CALL_FUNCTION0
15 LOAD_CONST   3 ('a')
18 STORE_SUBSCR

 4  19 LOAD_FAST0 (a)
22 PRINT_ITEM
23 PRINT_NEWLINE
24 LOAD_CONST   0 (None)
27 RETURN_VALUE





It's hard to tell if that's what you actually need though without
deeper analysis of your requirements.


I think it's unlikely that the OP really does need to create names
dynamically, and should look at using either a dict indexed by the
letters of self.__abet, or a list indexed from 0 to 24 instead. But  
you

*are* correct about the need for a little more information ;-)

regards
Steve


--
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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



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


Re: Python's popularity

2008-12-23 Thread Adrian Cherry
r rt8...@gmail.com wrote in
news:ae1bb365-7755-4c5f-8166-e704c51a7...@i20g2000prf.googlegro
ups.com: 

 
 Oh Steve... Listen, my words are ment as a wake-up-call to
 all who still love Python, and i believe you are one of
 them. Maybe old age has slowed your hand, that's OK, Us
 youngsters will take the helm. And be serious, do you
 really think this group is read by hundreds-of- thousands
 of news readers? I wish it were, but I highly doubt it. 
 

Thus spake the artilleryman from Horsell Common!

Adrian Cherry

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


Re: iterating initalizations

2008-12-23 Thread D'Arcy J.M. Cain
On Tue, 23 Dec 2008 10:20:59 -0500
Steve Holden st...@holdenweb.com wrote:
 D'Arcy J.M. Cain wrote:
  Well, if all you want is a loop:
  
  for v in vars:
  locals()[v] = []
  
 Note that this isn't guaranteed to work. While locals() will return a
 dict containing the names and values from the local namespace, you won't
 affect the local namespace by assigning values to the appropriate keys:
 
  def f():
 ...   a = hello
 ...   locals()[a] = goodbye
 ...   print a

This was my test:

 locals()['x'] = hello
 x
'hello'
 locals()['x'] = goodbye
 x
'goodbye'

Just didn't want people to think that I post without testing.

In any case, even if that worked as expected I am pretty sure that it
is the wrong solution but without knowing more about what the OP is
doing it is impossible to know what the right answer is.

-- 
D'Arcy J.M. Cain da...@druid.net |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
--
http://mail.python.org/mailman/listinfo/python-list


Re: I always wonder ...

2008-12-23 Thread r
On Dec 22, 11:12 pm, ajaksu aja...@gmail.com wrote:
 On Dec 22, 9:24 pm, r rt8...@gmail.com wrote:

  You know what i hate more than a troll, a spineless jellyfish who goes
  around rating peoples post with one star. You are the lowest form of
  life. You are the same type of person who would key someones car in
  the parking lot. You do not have the balls to face you enemy.

  If who made a rating were visible, then i would have respect for you,
  but since you lurk in the shadows, you are scum. Come out and face me
  if you dare!

  I never have rated a post UNLESS i rate it with 5 stars, WHY, you ask,
  Because my balls are so big i walk around bow-legged! F'in  Cowards!

 That would be me, for at least a dozen of your posts. Glad to know it
 was more effective than telling you to shut up or calm down.

 Cnidaria-ly y'rs,
 Daniel

Well that shows that even lads with tiny nads can be brave, any of the
other trolls want to expose them selfs?
--
http://mail.python.org/mailman/listinfo/python-list


Re: pseudo terminal usage from Python?

2008-12-23 Thread Grant Edwards
On 2008-12-23, s...@pobox.com s...@pobox.com wrote:

 I ran into an interesting problem yesterday.  The mpstat(1) command on
 Solaris formats its output like so:

   CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
 0   42   1 1184   812  265  227   12   44   370  11316   2   0  93
 1   25   1  933   4472  203   37   75   120   9025   4   0  91
 2   17   0  195   4951  201   41   77   130   5145   1   0  94
 34   0  117   882  405  171   34   65   210   4495   2   0  93

 I'm only interested in presenting the CPU numbers and user+sys values
 prefixed by a timestamp.  For example, the above might be formatted like so:

 07:28:46.373328 0 8 1 9 2 6 3 7

 The obvious solution might be something simple like this:

 mpstat 1 | python mympstat.py

 where mympstat.py does a trival amount of reformatting.

 The problem is that mpstat recognizes when its output is a pipe and block
 buffers it so the Python script sees input in massive blobs, not the
 second-by-second output you'd see running mpstat 1 by itself.

Are you sure it's not Python buffering its input?  Have you
tried python -u mympstat.py?

 I suspect there is some magic I can perform with pseudo terminals (this is
 on Solaris 10.)  The documentation for the pty module contains no examples
 and I've been so far unable to find any using Google.

I had a Linux pty example running once upon a time.  If python -u
doesn't work post again, and I'll try to find it.

-- 
Grant Edwards   grante Yow! Please come home with
  at   me ... I have Tylenol!!
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-23 Thread r
On Dec 23, 8:21 am, Thorsten Kampe thors...@thorstenkampe.de wrote:
 * r (Mon, 22 Dec 2008 10:44:32 -0800 (PST))

  Steve Holden
   What makes you assume this is a zero-sum game, and that Python won't
   survive if any other language becomes popular. Every language borrows
   from those that came before it. Terms like outright plagiarism don't
   encourage rational debate, and make you seem like a troll who is more
   interested in stirring up controversy than actually doing things to help
   promote the language.

  This is a war Steve, and i will explain why. Python does not need to
  compete with perl, lisp, C, basic, etc, etc. WHY, well because python
  is SO radically different than those languages. Ruby on the other
  hand, took most from python, the only difference is Ruby's full OO
  integration.(12.method()). Since Ruby is so similar to python [...]

 You don't have a single clue about neither Python nor Ruby:
 'According to the Ruby FAQ, If you like Perl, you will like Ruby and be
 right at home with its syntax. [...] If you like Python, you may or may
 not be put off by the huge difference in design philosophy between
 Python and Ruby/Perl.'[1]

 Thorsten
 [1]http://en.wikipedia.org/wiki/Ruby_(programming_language)#Semantics

Thats Thurstan, thank you very much! :)
--
http://mail.python.org/mailman/listinfo/python-list


Re: iterating initalizations

2008-12-23 Thread Steve Holden
D'Arcy J.M. Cain wrote:
 On Tue, 23 Dec 2008 10:20:59 -0500
 Steve Holden st...@holdenweb.com wrote:
 D'Arcy J.M. Cain wrote:
 Well, if all you want is a loop:

 for v in vars:
 locals()[v] = []

 Note that this isn't guaranteed to work. While locals() will return a
 dict containing the names and values from the local namespace, you won't
 affect the local namespace by assigning values to the appropriate keys:

 def f():
 ...   a = hello
 ...   locals()[a] = goodbye
 ...   print a
 
 This was my test:
 
 locals()['x'] = hello
 x
 'hello'
 locals()['x'] = goodbye
 x
 'goodbye'
 
 Just didn't want people to think that I post without testing.
 
 In any case, even if that worked as expected I am pretty sure that it
 is the wrong solution but without knowing more about what the OP is
 doing it is impossible to know what the right answer is.
 
The thing you overlooked was that the locals of a function are special.
The locals of a module are the globals!

 def lisg():
...   return locals() is globals()
...
 locals() is globals()
True
 lisg()
False


regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: pseudo terminal usage from Python?

2008-12-23 Thread skip
Grant Are you sure it's not Python buffering its input?  Have you tried
Grant python -u mympstat.py?

Hmmm...  No, I hadn't considered that.  I'll check it out.  Thanks...

Grant I had a Linux pty example running once upon a time.  If python
Grant -u doesn't work post again, and I'll try to find it.

Would be helpful even if I don't need it for this task, as I've not been
able to find any simple examples on the net.  (Maybe there's a recipe at
ActiveState, but Google didn't pick up anything with the search terms I was
using.)

Skip

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


Re: Python's popularity

2008-12-23 Thread r
On Dec 23, 10:12 am, je.s.t...@hehxduhmp.org wrote:
 r rt8...@gmail.com wrote:
  You are the epitimy of an internet troll. A troll tries to hide his
  identity. Why are you so concerned about your TRUE identity. Are the

 I've already stated, and you've already proven, that it's pretty trivial
 to ascertain my true identity, if one actually cares.  OTOH, that's
 *not* the case with you.  Who is hiding now?

I told you, my name is Thurstan Howell III. Do you want to know my
favorite color too?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-23 Thread r
On Dec 23, 8:21 am, Thorsten Kampe thors...@thorstenkampe.de wrote:
 You don't have a single clue about neither Python nor Ruby:
 'According to the Ruby FAQ, If you like Perl, you will like Ruby and be
 right at home with its syntax. [...] If you like Python, you may or may
 not be put off by the huge difference in design philosophy between
 Python and Ruby/Perl.'[1]

So you read the preface to the tut and that somehow makes you more
than a R00b n00b? Come on!

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


Re: no sign() function ?

2008-12-23 Thread Mark Dickinson
On Dec 23, 2:59 pm, Christian Heimes li...@cheimes.de wrote:
 All algorithm including my own suffer from one mistake. Nobody accounts
 for NaN (not a number). You have to check for NaNs, too. NaNs have no
 sign at all.

I think that's not quite true:  NaNs have a sign;  it's just not
accorded any particular meaning by IEEE 754---in particular,
the standard says nothing about the sign of a NaN result
for most arithmetic operations. However, the sign bit of
a NaN does play its usual role in operations like
copysign, abs, negation.  For example, here's a Python
2.6 session on OS X, where the 'default' nan is negative,
in the sense that its sign bit is set:

 nan = float('nan')
 from math import copysign
 copysign(5.0, nan)
-5.0
 copysign(5.0, -nan)
5.0
 copysign(5.0, abs(nan))
5.0

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


Re: no sign() function ?

2008-12-23 Thread ajaksu
On Dec 22, 9:18 am, Christian Heimes li...@cheimes.de wrote:
 Sure? :) Are you aware that the IEEE 754 standard makes a difference
 between the floats +0.0 and -0.0?

 from math import atan2
 def sign(x):
     if x  0 or (x == 0 and atan2(x, -1.)  0.):
         return 1
     else:
         return -1

Is x ** 0  0. instead of atan2(x, -1.)  0. unreliable across
platforms?


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


Get applications to open a given file (Mac and, or Windows)

2008-12-23 Thread riklau...@gmail.com
Under Linux/Unix I use GIO (pygobject) or gnome-vfs-python to get a
list of installed applications that can open given file (for example
image in graphics software). Is there something that can be used for
MS Windows or Mac OS X?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's popularity

2008-12-23 Thread r
Benjamin Kaplin wrote:
You're the one who keeps bringing up the need to spread python. For
most people, this is a forum to ask questions and have experts respond
to them. Most people who post here aren't looking for your opinion,
they want answers. If you know the answer to a question, answer it. If
not, read the answers of people who have seen it before. When you post
your opinions, you're just creating more noise.

School time son,
This forum is much more than a question answer session, son. Sure
people are welcome to ask a Python related question. But this forum is
really the main highway of Python development and future. If your a
n00b go to the Python forum.org, you will feel more comfy over
there.

If you have no opinion(Benjamin) thats your perogitive, don't tell me
how to live my life, or what I should do when i visit this forum. Do
I go to any of your threads and start a ruckus? NO, because if i do
not like what you are saying I will just ignore it. Take an example
son!

Sure i may have went off in thread, by i have kept my thought true to
the thread subject. A troll go's from thread to thread posting off
subject insults and attacks on other posters... hmmm, i have seen some
of those kind in this thread?? Know of who i speak, Bennie?
--
http://mail.python.org/mailman/listinfo/python-list


Re: no sign() function ?

2008-12-23 Thread Mark Dickinson
On Dec 23, 4:27 pm, ajaksu aja...@gmail.com wrote:
 Is x ** 0  0. instead of atan2(x, -1.)  0. unreliable across
 platforms?

x**0 doesn't distinguish between x = -0.0 and x = 0.0.

I suspect you're confusing -0.0**0.0 with (-0.0)**0.0.

Mark

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


Re: On Whose Desktop

2008-12-23 Thread Aaron Brady
On Dec 23, 8:19 am, Steve Holden st...@holdenweb.com wrote:
 Fuzzyman wrote:
  On Dec 23, 12:06 pm, Steve Holden st...@holdenweb.com wrote:
  Thanks to Barry Warsaw the On Your Desktop blog now has a new entry:

   http://onyourdesktop.blogspot.com/

  Who would you like to see profiled next?

  Guido (of course), Brett Cannon, Martin v Loewis, Jim Hugunin, Ted
  Leung, Dino Viehland (core developer of IronPython), Titus Brown, Ivan
  Kristic, Mark Shuttleworth, Tim Golden, Michele Simionato, Thomas
  Heller, Greg Ewing - any and all of these would be great.

  Any women in Python you could ask - how about Anna Ravenscroft?
  Bruno Desthuilliers wrote:

  The effbot ?

 s...@pobox.com wrote:
  Maybe Martin v. Loewis?  He contributes so much to Python.  I met him once
  several years ago at a Python conference (or maybe it was still just a
  workshop then), but beyond seeing his titanic contributions to Python, I
  know little about the guy.

 I hope *everyone* knows that Martin was the winner of this year's Frank
 Willison Award:

 http://www.python.org/community/awards/frank-willison/#martin-von-l-w...

 Great! Keep the suggestions coming, please!

+1 whose (posessive)
--
http://mail.python.org/mailman/listinfo/python-list


Re: On Whose Desktop

2008-12-23 Thread Arnaud Delobelle
Aaron Brady castiro...@gmail.com writes:
 +1 whose (posessive)

-1 posessive :)

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


Re: String Format Error.

2008-12-23 Thread Paulo Repreza
Thank You!

On Tue, Dec 23, 2008 at 3:49 AM, Steve Holden st...@holdenweb.com wrote:

  Chris Rebert wrote:
  On Mon, Dec 22, 2008 at 10:19 PM, Paulo Repreza pxrepr...@gmail.com
 wrote:
  Hi,
 
  I'm a newbie with python and I recently bought Beginning with Python
 (Which
  is a book I recommend) but the problem that I'm facing it's the
 following:
 
  This is the code:
 
  #!/usr/bin/python2.5
  # Filename: str_format.py
 
  age = 25
  name = 'foobar'
 
  print('{0} is {1} years old'.format(name, age))
  print('Why is {0} playing with that python?'.format(name))
 
 
  But when I run the script I receive this error:
 
  Traceback (most recent call last):
File str_format.py, line 7, in module
  print('{0} is {1} years old'.format(name, age))
  AttributeError: 'str' object has no attribute 'format'
 
 
  It is an error because of the version that I'm using ? Python 2.5.2
 (Debian
  lenny)
 
  Yes, Python 2.6 or higher is required to use .format() according to
  http://docs.python.org/whatsnew/2.6.html
 
 For a replacement that will work in 2.5, see the % sign as an operator
 (sometimes called string interpolation).

 regards
  Steve
 --
 Steve Holden+1 571 484 6266   +1 800 494 3119
 Holden Web LLC  http://www.holdenweb.com/

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

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


Re: wxPython.button.disabled still catching clicks

2008-12-23 Thread Mike Driscoll
On Dec 23, 7:27 am, mynthon mynth...@gmail.com wrote:
 On Dec 23, 11:58 am, Aaron Brady castiro...@gmail.com wrote:



  On Dec 23, 4:50 am, mynthon mynth...@gmail.com wrote:

   Hello! (sorry for my english)

   I have a problem with buttons in wxPython. When button is disabled
   (by .Disable() or .Enable(False)) it is grayed out but still receive
   clicks.

   Eg. i have button that disable itself, runs long action and enable
   itself:

   def onClick(self, evt):
       self.btn.Enable(False)
       for i in range (1000):
           print i
       self.btn.Enable(True)

   when for loop is running button is greyed out and when i click on it
   nothing happens but when loop ends another one is started because
   button remebered thad i click on it when was diabled. My only idea
   is to reposition button outside frame instead of disabling it but this
   solution is...not good.

   thanks for any help. Ive searched groups, google and it looks that
   only i have this problem :)

  No, it is very common.  During your for loop, the loop is dominating
  the process completely.  Events are just building up in the app's
  message queue, and don't get handled until after you yield on control.

  If you need to run a long task, look into threading, the OnIdle
  method, the 'multiprocessing' module, or pump messages during your
  long task.

 ok, maybe someone will need it. I dont know how it works because i
 didnt have time to read docs and i cannot explain everything. I used
 google and wxPython demo (in tree: wxpython overview / process and
 events / process)

 class leftPanel(wx.Panel):
     def __init__(self, parent, id):
         wx.Panel.__init__(self, parent, id, style=wx.BORDER_SUNKEN)

         # here you have to define new process, IDLE event, and
 onPRocessEnd event
         self.process = None
         self.GetParent().Bind(wx.EVT_IDLE, self.onIdle)
         self.Bind(wx.EVT_END_PROCESS, self.onProcessEnd)

         # create button and bind event to it
         self.runScriptBtn = wx.Button(self, -1, 'RUN ME!', (10,220))
         self.runScriptBtn.Bind(wx.EVT_BUTTON, self.onClick,
 self.runScriptBtn)

     def onClick(self, evt):
         # disable button
         self.runScriptBtn.Enable(False)

         # here you have to enter command to run
         # previusly i heve here exec('python myScript.py')
         # but now it will be a subprocess
         cmd = 'python xxx1.py'

         #create new process
         self.process = wx.Process(self)

         # dont know what it is for
         self.process.Redirect()

         # execute cmd command
         pid = wx.Execute(cmd, wx.EXEC_ASYNC, self.process)

     def onIdle(self, evt):
         # beacuse this method is called only when app enters idle mode
         # the line below is nedded to simulate entering idle mode
         # dont know how it works but it works
         evt.RequestMore(True)

         # here is some code to catch subprocess output
         if self.process is not None:
             stream = self.process.GetInputStream()
             if stream.CanRead():
                 text = stream.read()
                 print text

     def onProcessEnd(self, evt):
         # here is some code to catch subprocess output
         # when it is destroyed
         stream = self.process.GetInputStream()
         if stream.CanRead():
             text = stream.read()
             print text

         # dont know it is necessary
         self.process.CloseOutput()

         # remove (clear) process object
         self.process.Destroy()
         self.process = None

         # show button again
         self.runScriptBtn.Enable()

I'm pretty sure there's a better way to do this. If you disable the
button and click on it, you'll notice that it isn't firing events, so
something else is going on here. It seems like the wx.Frame or
wx.Application is queuing the mouse button clicks or something. I
would post to the wxPython mailing list: http://wxpython.org/maillist.php

They'll be better able to address this and they'll probably have a
simpler solution too.

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


Re: Python's popularity

2008-12-23 Thread Pierre-Alain Dorange
r rt8...@gmail.com wrote:

  I've already stated, and you've already proven, that it's pretty trivial
  to ascertain my true identity, if one actually cares.  OTOH, that's
  *not* the case with you.  Who is hiding now?
 
 I told you, my name is Thurstan Howell III. Do you want to know my
 favorite color too?

Only if it's pythonic.

-- 
Pierre-Alain Dorangehttp://microwar.sourceforge.net/

Ce message est sous licence Creative Commons by-nc-sa-2.0
http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
--
http://mail.python.org/mailman/listinfo/python-list


[Offtopic] Re: I always wonder ...

2008-12-23 Thread Pierre-Alain Dorange
r rt8...@gmail.com wrote:

 [...]
 Well that shows that even lads with tiny nads can be brave, any of the
 other trolls want to expose them selfs?

This thread is offtopic, please just keep silent and let it be closed...

-- 
Pierre-Alain Dorangehttp://microwar.sourceforge.net/

Ce message est sous licence Creative Commons by-nc-sa-2.0
http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
--
http://mail.python.org/mailman/listinfo/python-list


Re: pseudo terminal usage from Python?

2008-12-23 Thread Grant Edwards
On 2008-12-23, s...@pobox.com s...@pobox.com wrote:
 Grant Are you sure it's not Python buffering its input?  Have you tried
 Grant python -u mympstat.py?

 Hmmm...  No, I hadn't considered that.  I'll check it out.  Thanks...

 Grant I had a Linux pty example running once upon a time.  If python
 Grant -u doesn't work post again, and I'll try to find it.

 Would be helpful even if I don't need it for this task, as I've not been
 able to find any simple examples on the net.  (Maybe there's a recipe at
 ActiveState, but Google didn't pick up anything with the search terms I was
 using.)

I'll try to dig it up.  The application for which I was trying
to use ptys needed to communication modem control/status line
state info between master and slave (as well as parity and
word-length settings), so I abandoned ptys when I found they
only implement a small subset of the icotl's that are defined
for tty devices.

I've proposed enhancing the Linux pty driver so that it can
actually be used to simulate a serial port, but the proposal
has been ignored so far.

-- 
Grant Edwards   grante Yow! I'm definitely not
  at   in Omaha!
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: pseudo terminal usage from Python?

2008-12-23 Thread skip

Grant Are you sure it's not Python buffering its input?  Have you tried
Grant python -u mympstat.py?

Nope.  -u unbuffers stdout and stderr, not stdin.  It really must be mpstat
being uncooperative.

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


Re: Are python objects thread-safe?

2008-12-23 Thread Gabriel Genellina
En Tue, 23 Dec 2008 11:30:25 -0200, Duncan Booth  
duncan.bo...@invalid.invalid escribió:



Aaron Brady castiro...@gmail.com wrote:


Th.1   Th.2
a=X
   a=Y
a=Z

You are saying that if 'a=Z' interrupts 'a=Y' at the wrong time, the
destructor for 'X' or 'Y' might not get called.  Correct?  In serial
flow, the destructor for X is called, then Y.


No, the destructors will be called, but the destructors can do pretty  
much

anything they want so you can't say the assignment is atomic. This isn't
actually a threading issue: you don't need multiple threads to experience
werid issues here. If you do strange things in a destructor then you can
come up with confusing code even with a single thread.


A simple example showing what you said:

py class A:
...   def __del__(self):
... global a
... a = None
...
py a = A()
py a = 3
py print a
None

--
Gabriel Genellina

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


Re: python3 urlopen(...).read() returns bytes

2008-12-23 Thread ajaksu
On Dec 23, 12:51 pm, Christian Heimes li...@cheimes.de wrote:

 If you want to do it right ... It should be a clean patch against the
 py3k svn branch
Done

 including documentation
This thread is a good start :)

 and a unit test.
Doing this now.

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


Symposium “Visualization and Human-Computer” wit hin the IRF’2009 Conference – Announce Call for Papers

2008-12-23 Thread tava...@fe.up.pt


(Apologies for cross-posting)

Symposium on “Visualization and Human-Computer”
3rd International Conference on Integrity, Reliability  Failure
(IRF’2009)
Faculty of Engineering, University of Porto, Porto – PORTUGAL, 20-24
July 2009
http://paginas.fe.up.pt/clme/IRF2009/index.htm

(We would appreciate if you could distribute this information by your
colleagues and co-workers.)



Dear Colleague,

Within the 3rd International Conference on Integrity, Reliability 
Failure (IRF’2009), to be held in FEUP, Porto, Portugal, in July
20-24, 2009, we are organizing the Symposium “Visualization and Human-
Computer”.
Examples of some topics that will be considered are: Scientific Data
Visualization, Spatial Data in Visualization, Data Processing and
Analysis, Information Visualization, Visualization Techniques, Large
Data Visualization, Image Processing and Analysis, Hardware for
Visualization, Human-Computer Interaction, Visual Analytics, Visual
Data Mining and Knowledge Discovery, Human Perception, Interface
Design, Evaluation and User Studies, Software Development, Grid and
High Performance Computing, Applications in Engineering, Biomechanics,
Bioinformatics, Bioimaging, Physical, Earth, Space, Environmental and
Information Sciences.
Due to your research activities in those fields, we would like to
invite you to submit your work and participate in the Symposium
“Visualization and Human-Computer”.

For instructions and submission, please access to the conference
website at:
http://paginas.fe.up.pt/clme/IRF2009/index.htm
Please note that, when submitting your work you should select the
Symposium #7 “Visualization and Human-Computer”.

Important dates:

- February 28, 2009: Deadline for abstract submission;
- March 21, 2009: Notification of abstract acceptance;
- May 10, 2009: Receipt of Full Papers;
- July 20-24, 2009: Conference Events.

Kind regards,

João Manuel R. S. Tavares (University of Porto, Portugal,
tava...@fe.up.pt)
Renato Natal Jorge (University of Porto, Portugal, rna...@fe.up.pt)
(Symposium organizers)
--
http://mail.python.org/mailman/listinfo/python-list


Re: pseudo terminal usage from Python?

2008-12-23 Thread Grant Edwards
On 2008-12-23, s...@pobox.com s...@pobox.com wrote:

 Grant Are you sure it's not Python buffering its input?  Have you tried
 Grant python -u mympstat.py?

 Nope.  -u unbuffers stdout and stderr, not stdin.  It really must be mpstat
 being uncooperative.

That's not what my python man page says:

   -u Force stdin, stdout and stderr to be totally
  unbuffered.  On systems where it matters, also
  put stdin, stdout and stderr in binary mode.

That's for 2.5.2, but that's how I remember previous versions
working as well.
  
-- 
Grant Edwards   grante Yow! We have DIFFERENT
  at   amounts of HAIR --
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


2to3 used in the Shootout

2008-12-23 Thread bearophileHUGS
They have translated the Python benchmarks of the Shootout site from
Py2 to Py3 using 2to3:

http://shootout.alioth.debian.org/u32/benchmark.php?test=alllang=python3

It shows some performance bugs of Python3 itself (especially
regarding the binary-trees benchmark, that was unexpected by me), and
two points where 2to3 may be improved, for example after the
translation this gives error:
 table=string.maketrans('ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy',
'TGVHCDM
\nKNSYAAWBRTGVHCDMKNSYAAWBR')):

Gives:
TypeError: maketrans arguments must be bytes objects

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list


Re: pseudo terminal usage from Python?

2008-12-23 Thread skip
Grant Are you sure it's not Python buffering its input?  Have you tried
Grant python -u mympstat.py?

 Nope.  -u unbuffers stdout and stderr, not stdin.  It really must be
 mpstat being uncooperative.

Grant That's not what my python man page says:

Grant-u Force stdin, stdout and stderr to be totally
Grant   unbuffered.  On systems where it matters, also put
Grant   stdin, stdout and stderr in binary mode.

Grant That's for 2.5.2, but that's how I remember previous versions
Grant working as well.

I'm still running 2.4.5 at work.  It's -u help:

-u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
 see man page for details on internal buffering relating to '-u'

Was stdin unbuffering maybe added in 2.5?

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


[ANN] Python 2.5.4 (final)

2008-12-23 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm
happy to announce the release of Python 2.5.4 (final).

Python 2.5.3 unfortunately contained an incorrect patch that could
cause interpreter crashes; the only change in Python 2.5.4 relative
to 2.5.4 is the reversal of this patch.

2.5.4 is the last bug fix release of Python 2.5. Future 2.5.x releases
will only include security fixes. According to the release notes, about
80 bugs and patches have been addressed since Python 2.5.2, many of
them improving the stability of the interpreter, and improving its
portability.

See the release notes at the website (also available as Misc/NEWS in
the source distribution) for details of bugs fixed; most of them prevent
interpreter crashes (and now cause proper Python exceptions in cases
where the interpreter may have crashed before).

For more information on Python 2.5.4, including download
links for various platforms, release notes, and known issues, please
see:

http://www.python.org/2.5.4

Highlights of the previous major Python releases are available
from the Python 2.5 page, at

http://www.python.org/2.5/highlights.html

Enjoy this release,
Martin

Martin v. Loewis
mar...@v.loewis.de
Python Release Manager
(on behalf of the entire python-dev team)
--
http://mail.python.org/mailman/listinfo/python-list


Re: PIL - font kerning

2008-12-23 Thread Ivan Illarionov
On 23 дек, 16:44, carsn carsten.kr...@gmail.com wrote:
 Hey all,

 anybody know, if there´s a way to specify the kerning of a font, when
 you draw text with PIL?

 I´d like to achieve the same effect that you get, when you set a
 negative kerning in Gimp/Photshop - ie. reduce the spacing between
 glyphs.

 Can PIL do that or do I use another lib for that?

 Thx for any pointers  some nice xmas days to U all!
 carsten

No. PIL can't do that. I suggest combination of cairo/pango/pangocairo
(pycairo and pygtk packages).

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


Re: Are python objects thread-safe?

2008-12-23 Thread Aaron Brady
On Dec 23, 7:30 am, Duncan Booth duncan.bo...@invalid.invalid wrote:
 Aaron Brady castiro...@gmail.com wrote:
  Th.1   Th.2
  a=X
         a=Y
  a=Z

  You are saying that if 'a=Z' interrupts 'a=Y' at the wrong time, the
  destructor for 'X' or 'Y' might not get called.  Correct?  In serial
  flow, the destructor for X is called, then Y.

 No, the destructors will be called, but the destructors can do pretty much
 anything they want so you can't say the assignment is atomic. This isn't
 actually a threading issue: you don't need multiple threads to experience
 werid issues here. If you do strange things in a destructor then you can
 come up with confusing code even with a single thread.

I see.  What about

del a
a= Z

Then, can we say 'a=Z' is atomic?  At least, it eliminates the
destructor issue you raise.

  Other nasty things can happen if you use dictionaries from multiple
  threads. You cannot add or remove a dictionary key while iterating over
  a dictionary. This isn't normally a big issue, but as soon as you try to
  share the dictionary between threads you'll have to be careful never to
  iterate through it.

  These aren't documented, IIRC.  Did you just discover them by trial
  and error?

 It is documented, but I can't remember where for Python 2.x. For Python 3,
 PEP 3106 says: As in Python 2.x, mutating a dict while iterating over it
 using an iterator has an undefined effect and will in most cases raise a
 RuntimeError exception. (This is similar to the guarantees made by the Java
 Collections Framework.)

I infer that d.items() holds the GIL during the entire operation, and
it's safe to put in a thread.  It is merely using an iterator that is
unsafe.  (Python 3.0 removed d.items(), leaving only the iterator, I
understand.)

I'm looking at the code, and I don't see where the size is safely
checked.  That is, can't I sneak in an add and a remove during
iteration, so long as it doesn't catch me?

I'm looking at 'dict_traverse':
while (PyDict_Next(op, i, pk, pv)) {
Py_VISIT(pk);
Py_VISIT(pv);
}

No locks are acquired here, though I might have missed acquiring the
GIL somewhere else.

In the OP's example, he wasn't changing the size of the dict.
--
http://mail.python.org/mailman/listinfo/python-list


Re: PIL - font kerning

2008-12-23 Thread Ivan Illarionov
On Dec 23, 11:22 pm, Ivan Illarionov ivan.illario...@gmail.com
wrote:
 On 23 дек, 16:44, carsn carsten.kr...@gmail.com wrote:

  Hey all,

  anybody know, if there´s a way to specify the kerning of a font, when
  you draw text with PIL?

  I´d like to achieve the same effect that you get, when you set a
  negative kerning in Gimp/Photshop - ie. reduce the spacing between
  glyphs.

  Can PIL do that or do I use another lib for that?

  Thx for any pointers  some nice xmas days to U all!
  carsten

 No. PIL can't do that. I suggest combination of cairo/pango/pangocairo
 (pycairo and pygtk packages).

 Ivan

I found a little helper function that does what you want (and more)

import cairo
import pango
import pangocairo

def draw_text(surface, context, text, font=sans 14, position=None,
color=None,
box_width=None,
alignment=pango.ALIGN_CENTER,
line_spacing=None, letter_spacing=None,
extra_kerning=None):
if color is None:
color = (0.0, 0.0, 0.0)
context.set_source_rgb(*color)
pc = pangocairo.CairoContext(context)
layout = pc.create_layout()
layout.set_text(text)
layout.set_font_description(pango.FontDescription(font))
if box_width: layout.set_width(box_width)
layout.set_alignment(alignment)
if line_spacing: layout.set_spacing(spacing)
alist = pango.AttrList()
if letter_spacing:
alist.insert(pango.AttrLetterSpacing(letter_spacing, 0, len
(text)))
if extra_kerning:
for pos, kern in extra_kerning.iteritems():
alist.insert(pango.AttrLetterSpacing(kern, pos, pos
+1))
layout.set_attributes(alist)
if position is None:
width, height = surface.get_width(), surface.get_height()
w, h = layout.get_pixel_size()
position = (width/2.0 - w/2.0, height/2.0 - h/2.0)
context.move_to(*position)
pc.show_layout(layout)

And example usage:

surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
context = cairo.Context(surface)
draw_text(surface, context, 'Hello world!',
font=sans 52, color=(.25,.28,.33),
letter_spacing=-6000,
extra_kerning={0:-9000, 1:-1000, 6:6000, 7:-15000, 8:5000,
9:-7000})

surface.write_to_png(hello.png)

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


Re: pseudo terminal usage from Python?

2008-12-23 Thread Grant Edwards
On 2008-12-23, s...@pobox.com s...@pobox.com wrote:
 Grant Are you sure it's not Python buffering its input?  Have you tried
 Grant python -u mympstat.py?

  Nope.  -u unbuffers stdout and stderr, not stdin.  It really must be
  mpstat being uncooperative.

 Grant That's not what my python man page says:

 Grant-u Force stdin, stdout and stderr to be totally
 Grant   unbuffered.  On systems where it matters, also put
 Grant   stdin, stdout and stderr in binary mode.

 Grant That's for 2.5.2, but that's how I remember previous versions
 Grant working as well.

 I'm still running 2.4.5 at work.  It's -u help:

 -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
  see man page for details on internal buffering relating to '-u'

 Was stdin unbuffering maybe added in 2.5?

Let's do some experiments...

  $ cat echo.py
  import sys

  while 1:
  line = sys.stdin.readline()
  sys.stdout.write(line)

  $ (while sleep 1; do date; done) | python2.4 echo.py

[I see a line printed once per second.]

  $ (while sleep 1; do date; done) | python2.5 echo.py

[same as 2.4]

Is python stdin is line-buffered by default?  We'll do a
version that doesn't have newlines in the input stream...

  $ cat echo2.py
  import sys

  while 1:
  sys.stdout.write(sys.stdin.read(1))


  $ (while sleep 1; do echo -n $(date); done) | python2.4 echo2.py

[wait 10-20 seconds -- no output.  When I hit ctrl-C, I see a
all the output.]

  $ (while sleep 1; do echo -n $(date); done) | python2.5 echo2.py

[same as 2.4]

It appears the by default both 2.4 and 2.5 have line-buffered
stdin.

Let's try -u...

  $ (while sleep 1; do echo -n $(date); done) | python2.4 -u echo2.py

[I see output once per second.]

  $ (while sleep 1; do echo -n $(date); done) | python2.5 -u echo2.py

[same as 2.4]

Under Linux, the '-u' option unbuffers stdin in both 2.4 and
2.5.  It just isn't mentioned in the help output or the man
page for 2.4.

-- 
Grant Edwards   grante Yow! Will the third world
  at   war keep Bosom Buddies
   visi.comoff the air?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Get applications to open a given file (Mac and, or Windows)

2008-12-23 Thread Tommy Nordgren


On Dec 23, 2008, at 5:29 PM, riklau...@gmail.com wrote:


Under Linux/Unix I use GIO (pygobject) or gnome-vfs-python to get a
list of installed applications that can open given file (for example
image in graphics software). Is there something that can be used for
MS Windows or Mac OS X?
--
http://mail.python.org/mailman/listinfo/python-list

On mac, there are the modules Carbon.Launch and Carbon.LaunchServices
Maybe you'll find useful items in the PyObjC framework as well
-
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
tommy.nordg...@comhem.se




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


Re: Beep

2008-12-23 Thread Ivan Illarionov
On Dec 22, 3:16 am, Jeffrey Barish jeff_bar...@earthlink.net wrote:
 I use sys.stdout.write('\a') to beep.  It works fine on Kubuntu, but not on
 two other platforms (one of which is Ubuntu).  I presume that the problem
 is due to a system configuration issue.  Can someone point me in the right
 direction?  Thanks.
 --
 Jeffrey Barish

gnome-terminal (default terminal on Ubuntu) uses X11 bell for its
beep.
Try 'xset b on' to turn the beep on. See 'man xset' for more options.

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


Re: [Haskell-cafe] Initializing GHC from Python

2008-12-23 Thread Jason Dusek
  I upmodded this on Reddit. Thank you for your work.

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


Re: iterating initalizations

2008-12-23 Thread Rhodri James
On Tue, 23 Dec 2008 15:39:52 -, Aaron Stepp stepp.aa...@gmail.com  
wrote:



import random
from rtcmix import *
from chimes_source import * # Chime.play()
from rhythmblock import * # rhythmBlock.rhythmTwist() and  
rhythmBlock.printStuff()
from pitchblock import * # pitchBlock.pitchTwist() and  
pitchBlock.printStuff()

from lenEval import *  #greaterThan.sovler()

indexrand = random.Random()
indexrand.seed(2)

chime = Chime()
notes = pitchBlock()
rhythm = rhythmBlock()
solve = greaterThan()

class arrayBlock:

def __init__(self, theTempo, start):
self.__A = []
self.__B = []
self.__start = start
self.__tempo = theTempo

def player(self, length, tempo, octave, pan, seed):

tempo = (120, self.__tempo)

for a in range(length):

one = indexrand.randint(0, 3)

two = indexrand.randint(0, 7)

self.__A = self.__A + notes.pitchTwist(one , two)

for b in range(length):

one = indexrand.randint(0, 3)

two = indexrand.randint(0, 7)

self.__B = self.__B + rhythm.rhythmTwist(one , two)

lenA = len(self.__A)
lenB = len(self.__B)

var = solve.solver(lenA, lenB)


for c in range(var):

print self.__A[c]

self.__start = self.__start + tb(self.__B[var])

chime.play(self.__start, self.__A[var], octave, pan, 
seed)

This almost does exactly what I want, and is far cleaner than my  
previous attempts.


The only problem is that now all my arguments are being passed as zeros!


Which all your arguments?  There are an awful lot there; what *exactly*  
do

you mean?


I assume this has to do with WHEN I'm referencing self.__A and self.__B?


If you mean __A and __B are full of zeroes, then you should suspect your
notes.pitchTwist() and rhythm.rhythmTwist() methods of returning zeroes.

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: python3 urlopen(...).read() returns bytes

2008-12-23 Thread ajaksu
On Dec 23, 12:51 pm, Christian Heimes li...@cheimes.de wrote:
 If you want to do it right ... It should be a clean patch against the
 py3k svn branch including documentation and a unit test.

Got all three at http://bugs.python.org/issue4733 . Probably got all
three wrong too, so any feedback is very welcome :)

I think a neat improvement, besides better docs, names, code, etc.,
would be to implement Carl Bank's idea of checking Content-Encoding.

Oh, and there's a 'print(Using default charset '%s' %
response.charset)' in there that seemed educational when I wrote it,
but now sounds lame :)

Glenn, can you test the patch[1] there?

Thanks for the encouragement, Chris! I hope we don't regret it :D

Daniel

[1]http://bugs.python.org/file12437/urlopen_text.diff
--
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] Python 2.5.4 (final)

2008-12-23 Thread Terry Reedy

Martin v. Löwis wrote:


For more information on Python 2.5.4, including download
links for various platforms, release notes, and known issues, please
see:

http://www.python.org/2.5.4


http://www.python.org/download/releases/2.5.4/

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


Re: 2to3 used in the Shootout

2008-12-23 Thread Terry Reedy

bearophileh...@lycos.com wrote:

They have translated the Python benchmarks of the Shootout site from
Py2 to Py3 using 2to3:

http://shootout.alioth.debian.org/u32/benchmark.php?test=alllang=python3

It shows some performance bugs of Python3 itself (especially
regarding the binary-trees benchmark, that was unexpected by me), and
two points where 2to3 may be improved, for example after the
translation this gives error:
 table=string.maketrans('ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy',
'TGVHCDM
\nKNSYAAWBRTGVHCDMKNSYAAWBR')):

Gives:
TypeError: maketrans arguments must be bytes objects


Perhaps you could file a tracker item.

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


Re: SuSE11.1 eclipse 64 pydev can't add python path

2008-12-23 Thread Nikolas Tautenhahn
Hi,

Reimar Bauer wrote:
 I can install pydev using the update manager in eclipse for 64 bit from the
 SuSE 11.1 repo. But I can't configure pydev without crashing it.
 I can select the interpreter /usr/bin/python
 and I do see the System PYTHONPATH
 Forced builtin libs also looks good.
 
 But Apply gives me
 #
 # An unexpected error has been detected by Java Runtime Environment:
 #
 # SIGSEGV (0xb) at pc=0x7f2d7abebaed, pid=6544, tid=139832007596368
 #
 # Java VM: IcedTea 64-Bit Server VM (1.7.0-b24 mixed mode linux-amd64)
 # Problematic frame:
 # V [libjvm.so+0x21baed]
 #
 # An error report file with more information is saved as:
 # /home/user/hs_err_pid6544.log
 #
 # If you would like to submit a bug report, please visit:
 # http://icedtea.classpath.org/bugzilla
 # The crash happened outside the Java Virtual Machine in native code.
 # See problematic frame for where to report the bug.

unfortunately I can't help but reproduce the problem. My eclipse was
already configured when I updated openSuSE 11.0 to 11.1 so it is not
*that* bad for me (only when I install new eggs and want pydev to take
notice of them).

The question is who is responsible for this... java? pydev? (suse?)

If you open a ticket in a bugtracker, please post the url here and I
will add myself, too

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


Re: 2to3 used in the Shootout

2008-12-23 Thread Isaac Gouy
On Dec 23, 11:51 am, bearophileh...@lycos.com wrote:
 They have translated the Python benchmarks of the Shootout site from
 Py2 to Py3 using 2to3:

 http://shootout.alioth.debian.org/u32/benchmark.php?test=all〈=pyt...


So please re-write those programs to remove problems created by
automatic translation and better take advantage of Python 3
functionality...


http://shootout.alioth.debian.org/u32/faq.php#play



 It shows some performance bugs of Python3 itself (especially
 regarding the binary-trees benchmark, that was unexpected by me), and
 two points where 2to3 may be improved, for example after the
 translation this gives error:
          table=string.maketrans('ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy',
                                 'TGVHCDM
 \nKNSYAAWBRTGVHCDMKNSYAAWBR')):

 Gives:
 TypeError: maketrans arguments must be bytes objects

 Bye,
 bearophile

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


Re: no sign() function ?

2008-12-23 Thread ajaksu
On Dec 23, 2:45 pm, Mark Dickinson dicki...@gmail.com wrote:
 On Dec 23, 4:27 pm, ajaksu aja...@gmail.com wrote:

  Is x ** 0  0. instead of atan2(x, -1.)  0. unreliable across
  platforms?

 x**0 doesn't distinguish between x = -0.0 and x = 0.0.

 I suspect you're confusing -0.0**0.0 with (-0.0)**0.0.

Yes, fooled me :)

Thanks for the heads-up!

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


Re: SuSE11.1 eclipse 64 pydev can't add python path

2008-12-23 Thread Benjamin Kaplan
On Tue, Dec 23, 2008 at 5:08 PM, Nikolas Tautenhahn virt...@gmx.de wrote:

 Hi,

 Reimar Bauer wrote:
  I can install pydev using the update manager in eclipse for 64 bit from
 the
  SuSE 11.1 repo. But I can't configure pydev without crashing it.
  I can select the interpreter /usr/bin/python
  and I do see the System PYTHONPATH
  Forced builtin libs also looks good.
 
  But Apply gives me
  #
  # An unexpected error has been detected by Java Runtime Environment:
  #
  # SIGSEGV (0xb) at pc=0x7f2d7abebaed, pid=6544, tid=139832007596368
  #
  # Java VM: IcedTea 64-Bit Server VM (1.7.0-b24 mixed mode linux-amd64)
  # Problematic frame:
  # V [libjvm.so+0x21baed]
  #
  # An error report file with more information is saved as:
  # /home/user/hs_err_pid6544.log
  #
  # If you would like to submit a bug report, please visit:
  # http://icedtea.classpath.org/bugzilla
  # The crash happened outside the Java Virtual Machine in native code.
  # See problematic frame for where to report the bug.

 unfortunately I can't help but reproduce the problem. My eclipse was
 already configured when I updated openSuSE 11.0 to 11.1 so it is not
 *that* bad for me (only when I install new eggs and want pydev to take
 notice of them).

 The question is who is responsible for this... java? pydev? (suse?)


If it was a PyDev problem, you'd see either a Python or a Java error
message. This is a known bug in the HotSpot VM on Linux 64. It affects both
the Sun and OpenJDK versions of Java. It was fixed in the newer builds.



 If you open a ticket in a bugtracker, please post the url here and I
 will add myself, too

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

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


  1   2   >