Re: Create xml with elementtree ET and xml escaping

2012-12-15 Thread Stefan Behnel
nenad.ci...@gmail.com, 12.12.2012 03:19:
> Il giorno martedì 11 dicembre 2012 20:59:54 UTC+1, MRAB ha scritto:
>>
>>> Since I have also the need to sign the XML I need the ability to create xml 
>>> but without xml escaping (unescaped data are signed).
>>
>> XML with the escaping isn't valid XML.
> 
> Of course I know it is not valid without escaping. But I need it only for 
> signing. I will recheck this if really the web service wants the data to be 
> signed as non escaped.

If it expects non-XML, you should tell the owners of the web service so
that they can fix it.

Stefan


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


sum returns numpy.float64 when applied to a sequence of numpy.uint64

2012-12-15 Thread suzaku
I came across this question on StackOverflow today: 
http://stackoverflow.com/questions/13890451/why-numpy-sum-returns-a-float64-instead-of-an-uint64-when-adding-elements-of-a-g

I'm not familiar with `numpy` but I'm curious about this, so I started doing 
some experiments.

This is what I have discovered so far:

1. when a `generator ` is passed to `numpy.sum`, it fallback to use Python's 
built-in `sum`.

2. if elements of the sequence passed to `sum` is of type `numpy.uint64`, the 
result would be a number of type `numpy.float64`;

3. when I tried it with `numpy.int64`, the result is as expected: `numpy.int64`.

I guess the reason maybe that we don't really have `64 bits unsigned integer` 
in Python, so the numbers get converted to something different. And if so, I 
have no idea why it chose `float64` as the type.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are the minimum requirements to get a job in?

2012-12-15 Thread Wolfgang Strobl
Christian Heimes :

>To be fair, memcpy() is a pretty simple function. 

This, of course, depends on the target architecture. See for example
 or


>It can be implemented
>in just about two lines of C code plus five lines of boiler plate. 

Or in a single line of IBM 360 ASM/F Code, plus boiler plate. :-)


In 1979, I implemented various block move code snippets for three
different eight bit microprocessors of that time. The parameterized
variant took between 20 and >30 instructions.  

-- 
Wir danken für die Beachtung aller Sicherheitsbestimmungen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are the minimum requirements to get a job in?

2012-12-15 Thread Chris Angelico
On Sat, Dec 15, 2012 at 10:29 PM, Wolfgang Strobl  wrote:
> Christian Heimes :
>
>>To be fair, memcpy() is a pretty simple function.
>
> This, of course, depends on the target architecture. See for example
>  or
> 
>
>>It can be implemented
>>in just about two lines of C code plus five lines of boiler plate.
>
> Or in a single line of IBM 360 ASM/F Code, plus boiler plate. :-)
> 
>
> In 1979, I implemented various block move code snippets for three
> different eight bit microprocessors of that time. The parameterized
> variant took between 20 and >30 instructions.

Same in 8086 - you just do a REP MOVSB (after setting CX to the
length, DS:SI to the source, ES:DI to the destination). But it's
slower than the equivalent with more explicit register action.

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


Pexpect and buffering

2012-12-15 Thread jim . hefferon
Hello,

I'm trying to use pexpect to grab interactions with Python's REPL.  I am having 
trouble with tracebacks.  Possibly it is related to buffering (hence the 
subject line) but I admit that's a guess.

At the end of this message is a minimal example program.  It feeds three 
commands to a python interpreter.  The second command should fail like this.

>>> a
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'a' is not defined
>>> 

However, pexpect only returns part of that "Traceback .." message, that is, 
pexpect is not waiting for the >>> prompt.  I have included the output of the 
program below, after the program.  

(In case it helps, spawning Python with -u doesn't make any difference.)

I'd be very glad for any suggestions.
Jim

The program:
--
#!/usr/bin/python
import sys, os, re, pprint
import pexpect

cmds = ['1+2', 'a', '3+4']
PROMPT = '>>> '
PROMPT_CONTINUE = '... '

child = pexpect.spawn('python')  # start the repl
# child = pexpect.spawn('python', maxread=1)  # makes no difference
child.expect([PROMPT])
print "  initial child.before=",pprint.pformat(child.before)
print "  initial child.after=",pprint.pformat(child.after)

r = [] 
for cmd in cmds:
print "++ cmd=",pprint.pformat(cmd)
child.sendline(cmd)
dex = child.expect([PROMPT, PROMPT_CONTINUE])
print "  child.before=",pprint.pformat(child.before)
print "  child.after=",pprint.pformat(child.after)
r.append(child.before)
print "r=",pprint.pformat(r)
-

My screen when I run this (Ubuntu 12.04 with Python 2.7.3).

$ ./minex.py
  initial child.before= 'Python 2.7.3 (default, Aug  1 2012, 05:16:07) \r\n[GCC 
4.6.3] on linux2\r\nType "help", "copyright", "credits" or "license" for more 
information.\r\n'
  initial child.after= '>>> '
++ cmd= '1+2'
  child.before= '1+2\r\n3\r\n'
  child.after= '>>> '
++ cmd= 'a'
  child.before= 'a\r\nTraceb'
  child.after= 'ack '
++ cmd= '3+4'
  child.before= '(m'
  child.after= 'ost '
r= ['1+2\r\n3\r\n', 'a\r\nTraceb', '(m']
-- 
http://mail.python.org/mailman/listinfo/python-list


Lost in Black-jack

2012-12-15 Thread Son Tung Nguyen Trong
I'm stuck in Phase 1- Get_value method and deal_card in Back-jack project and 
the course in Coursea as well :(. I just returned and working on it, this is 
what I've done so far. Can you guys help me? I really wanna accomplish this 
course. 

http://www.codeskulptor.org/#user7-xlgwHlbg4O-0.py
-- 
http://mail.python.org/mailman/listinfo/python-list


Lost in Black-jack

2012-12-15 Thread Son Tung Nguyen Trong
I'm stuck in Phase 1- Get_value method and deal_card in Back-jack project and 
the course in Coursea as well :(. I just returned and working on it, this is 
what I've done so far. Can you guys help me? I really wanna accomplish this 
course. 

http://www.codeskulptor.org/#user7-xlgwHlbg4O-0.py 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lost in Black-jack

2012-12-15 Thread Chris Angelico
On Sat, Dec 15, 2012 at 11:47 PM, Son Tung Nguyen Trong
 wrote:
> I'm stuck in Phase 1- Get_value method and deal_card in Back-jack project and 
> the course in Coursea as well :(. I just returned and working on it, this is 
> what I've done so far. Can you guys help me? I really wanna accomplish this 
> course.
>
> http://www.codeskulptor.org/#user7-xlgwHlbg4O-0.py

You have some code there. Can you be more specific as to the stuckness
you're experiencing? Does the program not do what it ought to do?
Throw an exception? Work perfectly, but not have all the features you
want it to have?

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


Re: Lost in Black-jack

2012-12-15 Thread Son Tung Nguyen Trong
Vào 20:27:42 UTC+7 Thứ bảy, ngày 15 tháng mười hai năm 2012, Chris Angelico đã 
viết:
> On Sat, Dec 15, 2012 at 11:47 PM, Son Tung Nguyen Trong
> 
>  wrote:
> 
> > I'm stuck in Phase 1- Get_value method and deal_card in Back-jack project 
> > and the course in Coursea as well :(. I just returned and working on it, 
> > this is what I've done so far. Can you guys help me? I really wanna 
> > accomplish this course.
> 
> >
> 
> > http://www.codeskulptor.org/#user7-xlgwHlbg4O-0.py
> 
> 
> 
> You have some code there. Can you be more specific as to the stuckness
> 
> you're experiencing? Does the program not do what it ought to do?
> 
> Throw an exception? Work perfectly, but not have all the features you
> 
> want it to have?
> 
> 
> 
> ChrisA

Actually I'm following jan grant and lost in implement get_rank method()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lost in Black-jack

2012-12-15 Thread Chris Angelico
On Sun, Dec 16, 2012 at 1:42 AM, Son Tung Nguyen Trong
 wrote:
> Vào 20:27:42 UTC+7 Thứ bảy, ngày 15 tháng mười hai năm 2012, Chris Angelico 
> đã viết:
>> On Sat, Dec 15, 2012 at 11:47 PM, Son Tung Nguyen Trong
>>
>>  wrote:
>>
>> > I'm stuck in Phase 1- Get_value method and deal_card in Back-jack project 
>> > and the course in Coursea as well :(. I just returned and working on it, 
>> > this is what I've done so far. Can you guys help me? I really wanna 
>> > accomplish this course.
>>
>> >
>>
>> > http://www.codeskulptor.org/#user7-xlgwHlbg4O-0.py
>>
>>
>>
>> You have some code there. Can you be more specific as to the stuckness
>>
>> you're experiencing? Does the program not do what it ought to do?
>>
>> Throw an exception? Work perfectly, but not have all the features you
>>
>> want it to have?
>>
>>
>>
>> ChrisA
>
> Actually I'm following jan grant and lost in implement get_rank method()

Two pieces of advice.

Step 1: Assume we know nothing of the course you're taking.

Step 2: Instead of making vague statements of "lost", say exactly what
you're having trouble with. We're not here to do your homework for
you. Ask a specific question (or ask about a specific topic, eg "I
don't understand how to X") and we'll happily answer. The goal of the
course is for you to gain competence, not for us to write code for
you, so ask questions with that in mind.

Step 3: For extra points, get yourself off Google Groups. Some of the
best responders here have a policy of dropping all posts from Google
Groups users, partly because of some stupidities in the interface that
result in double-spaced posts such as the above. You can subscribe to
python-list and read it all as email, or get a real newsreader, but
Google Groups is one of the quickest ways to restrict your potential
responses. If you're going to continue using GG, please give some
thought to the quoted text (trim it, and un-double-space it), and also
to the To: field - by default, it seems to send to both the newsgroup
and the list, which is unnecessary.

Another "extra credit" tip. Have a read of
http://www.catb.org/esr/faqs/smart-questions.html and be sure you
understand what it's saying. This isn't necessary for getting a
response, but it sure will help.

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


Re: What package to use for certificate manipulation (signing, hashing)

2012-12-15 Thread Nenad Cikic
I have managed to sign xml so I am reporting here in case some else needs this 
info.Also if someone more experienced see some possible improvment please leave 
a note.
So my input is a pfx file.
I am forced to use both pyopeenssl and m2crypto.
I am using PyOpenssl to extract certificate and private key.
pfx=open('/home/cikic/manc.pfx','rb').read()
PKCS=crypto.load_pkcs12(pfx,'mypfxpass')
cert=PKCS.get_certificate()
#PKey=cert.get_pubkey()
pk=PKCS.get_privatekey()
pkStr=crypto.dump_privatekey(crypto.FILETYPE_PEM,pk)

I am using PyOpenssl to extract pem, serial number and issuer from certificate 
but you could do it also with m2crypto.
I am constructin m2crypto RSA object with
   rsa=RSA.load_key_string(pkStr)
I am using m2crypto MessageDigest('sha1') or MessageDigest('md5') as needed and 
I am singing the hash with
  dig=MessageDigest('sha1')
  dig.update(xmlstring)
  dgst=dig.digest()
  retVal=rsa.sign(dgst,'sha1')
Then I use 
   sval=base64.b64encode(retVal)
to get the signature value

Essentially I use pyopenssl just to get private key since I didn't find 
m2crypto function that reads pfx file.

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


About UNIX shell trap, any relative function in Python ?

2012-12-15 Thread moonhkt

Hi All

Machine : AIX 5.3
Python : 2.6.2

In UNIX have, trap to run defined CLEAN_UP function. When  HUP INT
KILL STOP TERM will run CLEAN_UP function.

trap 'echo "\n\nProcessing Clean up"; CLEAN_UP; exit' HUP INT KILL
STOP TERM

Any relative function in Python ?

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


Re: About UNIX shell trap, any relative function in Python ?

2012-12-15 Thread Chris Angelico
On Sun, Dec 16, 2012 at 2:34 AM, moonhkt  wrote:
>
> Hi All
>
> Machine : AIX 5.3
> Python : 2.6.2
>
> In UNIX have, trap to run defined CLEAN_UP function. When  HUP INT
> KILL STOP TERM will run CLEAN_UP function.
>
> trap 'echo "\n\nProcessing Clean up"; CLEAN_UP; exit' HUP INT KILL
> STOP TERM
>
> Any relative function in Python ?

Yep! Check out the 'signal' module:

http://docs.python.org/3.3/library/signal.html

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


Re: About UNIX shell trap, any relative function in Python ?

2012-12-15 Thread Chris Angelico
On Sun, Dec 16, 2012 at 3:04 AM, Chris Angelico  wrote:
> On Sun, Dec 16, 2012 at 2:34 AM, moonhkt  wrote:
>>
>> Hi All
>>
>> Machine : AIX 5.3
>> Python : 2.6.2
>
> Yep! Check out the 'signal' module:
>
> http://docs.python.org/3.3/library/signal.html

Or, since you're working with 2.6.2:

http://docs.python.org/2.6/library/signal.html

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


[ANN] OpenOpt Suite release 0.43

2012-12-15 Thread dmitrey15
Hi all,

I'm glad to inform you about new OpenOpt release 0.43 (2012-Dec-15):

* Many improvements for solver interalg
* Some improvements for FuncDesigner kernel
* FuncDesigner stochastic addon  now can handle some problems with 
gradient-based NLP / NSP solvers
* Many minor improvements and some bugfixes

Visit  http://www.openopt.org  for more details.

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


Re: About UNIX shell trap, any relative function in Python ?

2012-12-15 Thread moonhkt
On 12月16日, 上午12時05分, Chris Angelico  wrote:
> On Sun, Dec 16, 2012 at 3:04 AM, Chris Angelico  wrote:
> > On Sun, Dec 16, 2012 at 2:34 AM, moonhkt  wrote:
>
> >> Hi All
>
> >> Machine : AIX 5.3
> >> Python : 2.6.2
>
> > Yep! Check out the 'signal' module:
>
> >http://docs.python.org/3.3/library/signal.html
>
> Or, since you're working with 2.6.2:
>
> http://docs.python.org/2.6/library/signal.html
>
> ChrisA

Thank. will try.
-- 
http://mail.python.org/mailman/listinfo/python-list


need some help with unexpected signal exception when using input from a thread (Pypy 1.9.0 on osx/linux)

2012-12-15 Thread Irmen de Jong
Hi.
Using Pypy 1.9.0. Importing readline. Using a background thread to get input() 
from
stdin. It then crashes with:

  File "/usr/local/Cellar/pypy/1.9/lib_pypy/pyrepl/unix_console.py", line 400, 
in restore
signal.signal(signal.SIGWINCH, self.old_sigwinch)
ValueError: signal() must be called from the main thread

Anyone seen this before? What's going on?
When I don't import readline, or do the input() from within the main thread, 
the problem
disappears.

(I tried to reproduce it in a small test scenario but unfortunately have not 
been able
to do so yet. Haven't figured out yet what the additional factors are that 
trigger this
problem. A simple import readline and input() from a new thread doesn't seem to 
trigger
it, unfortunately)


Regards
Irmen de Jong
-- 
http://mail.python.org/mailman/listinfo/python-list


problem with web browser module

2012-12-15 Thread Eric Johansson
I need to be able to invoke a specific webpage with Internet Explorer. 
If the browser is not up with that page, I needed to come up with that 
page. If the browser is already up, I only need to bring that browser 
and page to the top of the window piles.


When I use the web browser module today, it always seems to bring a new 
browser instance up. Is there anyway to get it to work with a single 
instance?


the use case is to invoke a specific evernote page and make it available 
for immediate dictation using speech recognition. There's a whole bunch 
of other things I need to do around the browser invocation but that's my 
problem and fortunately I know what I have to do.  I just need your help 
in making sure only a single browser instance is created and it 
references a single page. If I have multiple pages I need to refer to, 
it would be nice if they came up the separate tabs within the same 
browser instance.:-)


A clue or two would be welcome. Thanks

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


Is there a quick & accurate way to test a python install?

2012-12-15 Thread Gene Heskett
Greetings;

I had an app that is a heavy user of python crash on exit earlier today, 
and ever since, the app complains it can't find something in the python 
tree, and eventually the app exits.

The leading few lines of the dmesg report are:

Starting LinuxCNC...
redis server started as: 'redis-server ', logging to: /dev/null
(time=1355621147.276382,pid=5133): Registering server on TCP port 5005.
(time=1355621147.276602,pid=5133): running server for TCP port 5005 
(connection_socket = 3).
io started
iocontrol: machine: 'my-lathe'  version 'unknown'
halcmd loadusr io started
task pid=5195
task: machine: 'my-lathe'  version 'unknown'
emcTaskOnce: Python plugin configuredemcTaskOnce: extract(task_instance): 
KeyError: ('task',)

emcTaskOnce: no Python Task() instance available, using default iocontrol-
based task methods
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
A configuration error is preventing LinuxCNC from starting.

Then it throws several stanza's of unload messages, culmination in a
SEGMENTATION FAULT.

How can I check & see if my python install if alive?

Thanks.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page:  is up!
Restaurant package, not for resale.
I was taught to respect my elders, but its getting 
harder and harder to find any...
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2012-12-15 Thread Dustin Guerri
Hi there,

I'm new to Python and to programming.  is this the right place for me to
post a beginner question on Python use ?

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


Re:

2012-12-15 Thread Chris Angelico
On Sun, Dec 16, 2012 at 12:49 PM, Dustin Guerri  wrote:
> Hi there,
>
> I'm new to Python and to programming.  is this the right place for me to
> post a beginner question on Python use ?

Possibly! Depends on the question. You may also want to check out the
python-tutor list, which works in parallel with this one:

http://mail.python.org/mailman/listinfo/tutor

Have a look at its archives and the archives of this list:

http://mail.python.org/pipermail/tutor/
http://mail.python.org/pipermail/python-list/

You'll get an idea of the character of each list, which may tell you
which one is appropriate for your question. And hey, if you're lucky,
you might even find the answer right there!

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


Re:

2012-12-15 Thread Benjamin Kaplan
On Sat, Dec 15, 2012 at 5:49 PM, Dustin Guerri  wrote:
>
> Hi there,
>
> I'm new to Python and to programming.  is this the right place for me to
> post a beginner question on Python use ?
>
> Many thanks.
>

You could post questions here, but it would be better to use the
Python-tutor list for that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Terry Reedy

On 12/15/2012 8:38 PM, Gene Heskett wrote:

see
26.11.2. Running tests using the command-line interface
for your version. Note that there are a few errors all the time, at 
least when testing a user installation on windows, and you will have to 
hit return a few times to go past some tests meant to raise errors.



--
Terry Jan Reedy

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


Re: problem with web browser module

2012-12-15 Thread Terry Reedy

On 12/15/2012 6:11 PM, Eric Johansson wrote:

I need to be able to invoke a specific webpage with Internet Explorer.
If the browser is not up with that page, I needed to come up with that
page. If the browser is already up, I only need to bring that browser
and page to the top of the window piles.

When I use the web browser module today, it always seems to bring a new
browser instance up. Is there anyway to get it to work with a single
instance?

the use case is to invoke a specific evernote page and make it available
for immediate dictation using speech recognition. There's a whole bunch
of other things I need to do around the browser invocation but that's my
problem and fortunately I know what I have to do.  I just need your help
in making sure only a single browser instance is created and it
references a single page. If I have multiple pages I need to refer to,
it would be nice if they came up the separate tabs within the same
browser instance.:-)


I believe this worked with Firefox the last time I tested. I just read 
the docs. Never tried IE. I believe details partly depend on browser.


--
Terry Jan Reedy

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


Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Gene Heskett
On Saturday 15 December 2012 21:19:37 Terry Reedy did opine:

> On 12/15/2012 8:38 PM, Gene Heskett wrote:
> 
> see
> 26.11.2.

I'm not a python guru, Terry, so you will have to expand on this 26.11.2.

Thanks

> Running tests using the command-line interface
> for your version. Note that there are a few errors all the time, at
> least when testing a user installation on windows, and you will have to
> hit return a few times to go past some tests meant to raise errors.


Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page:  is up!
For gin, in cruel
Sober truth,
Supplies the fuel
For flaming youth.
-- Noel Coward
I was taught to respect my elders, but its getting 
harder and harder to find any...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Terry Reedy

On 12/15/2012 9:21 PM, Gene Heskett wrote:

On Saturday 15 December 2012 21:19:37 Terry Reedy did opine:


On 12/15/2012 8:38 PM, Gene Heskett wrote:

see
26.11.2.


I'm not a python guru, Terry, so you will have to expand on this 26.11.2.


http://docs.python.org/3/library/test.html#running-tests-using-the-command-line-interface

3.x on command line: python -m test
"Under the hood, it uses test.regrtest; the call python -m test.regrtest 
used in previous Python versions [ie, 2.x] still works)."


Followed by more options and os specifics. It is also possible to run 
interactively. 'import test; test.main()' may do it, but it have been 
awhile and is not documented.


--
Terry Jan Reedy

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


Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Gene Heskett
On Saturday 15 December 2012 21:52:00 Terry Reedy did opine:

> On 12/15/2012 9:21 PM, Gene Heskett wrote:
> > On Saturday 15 December 2012 21:19:37 Terry Reedy did opine:
> >> On 12/15/2012 8:38 PM, Gene Heskett wrote:
> >> 
> >> see
> >> 26.11.2.
> > 
> > I'm not a python guru, Terry, so you will have to expand on this
> > 26.11.2.
> 
> http://docs.python.org/3/library/test.html#running-tests-using-the-comma
> nd-line-interface

This is 2.6, on ubuntu-10.04.4 LTS
 
> 3.x on command line: python -m test
> "Under the hood, it uses test.regrtest; the call python -m test.regrtest
> used in previous Python versions [ie, 2.x] still works)."
> 
> Followed by more options and os specifics. It is also possible to run
> interactively. 'import test; test.main()' may do it, but it have been
> awhile and is not documented.

I googled and found something like that, but the machine thats bad throws 
the same error stanza as one that seems to work.  From the machine with the 
problem:

gene@lathe:/usr/lib/python2.6/test$ python -m test.regrtest
test_grammar
test_grammar skipped -- No module named test_grammar
test_opcodes
test_opcodes skipped -- No module named test_opcodes
test_dict
test_dict skipped -- No module named test_dict
test_builtin
test_builtin skipped -- No module named test_builtin
test_exceptions
test_exceptions skipped -- No module named test_exceptions
test_types
test_types skipped -- No module named test_types
test_unittest
test_unittest skipped -- No module named test_unittest
test_doctest
test_doctest skipped -- No module named test_doctest
test_doctest2
test_doctest2 skipped -- No module named test_doctest2
9 tests skipped:
test_builtin test_dict test_doctest test_doctest2 test_exceptions
test_grammar test_opcodes test_types test_unittest
Traceback (most recent call last):
  File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
  File "/usr/lib/python2.6/test/regrtest.py", line 1199, in 
main()
  File "/usr/lib/python2.6/test/regrtest.py", line 423, in main
e = _ExpectedSkips()
  File "/usr/lib/python2.6/test/regrtest.py", line 1112, in __init__
from test import test_timeout
ImportError: cannot import name test_timeout
gene@lathe:/usr/lib/python2.6/test$ 

I think that looks identical to this machine, given the identical command 
line.

Any other ideas, or is the above all foobar?

Thanks Terry.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page:  is up!
Drinking coffee for instant relaxation?  That's like drinking alcohol for
instant motor skills.
-- Marc Price
I was taught to respect my elders, but its getting 
harder and harder to find any...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Gene Heskett
On Saturday 15 December 2012 22:07:54 Terry Reedy did opine:

> On 12/15/2012 9:21 PM, Gene Heskett wrote:
> > On Saturday 15 December 2012 21:19:37 Terry Reedy did opine:
> >> On 12/15/2012 8:38 PM, Gene Heskett wrote:
> >> 
> >> see
> >> 26.11.2.
> > 
> > I'm not a python guru, Terry, so you will have to expand on this
> > 26.11.2.
> 
> http://docs.python.org/3/library/test.html#running-tests-using-the-comma
> nd-line-interface
> 
> 3.x on command line: python -m test
> "Under the hood, it uses test.regrtest; the call python -m test.regrtest
> used in previous Python versions [ie, 2.x] still works)."
> 
> Followed by more options and os specifics. It is also possible to run
> interactively. 'import test; test.main()' may do it, but it have been
> awhile and is not documented.

Ok, from that docs page:

root@coyote:/usr/lib/python2.6/test# python -m test -h
/usr/bin/python: test is a package and cannot be directly executed

Same return on all 3 machines.  ??

Thanks Terry.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page:  is up!
I prefer the most unjust peace to the most righteous war.
-- Cicero

Even peace may be purchased at too high a price.
-- Poor Richard
I was taught to respect my elders, but its getting 
harder and harder to find any...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pexpect and buffering

2012-12-15 Thread Chris Rebert
On Dec 15, 2012 4:51 AM,  wrote:
>
> Hello,
>
> I'm trying to use pexpect to grab interactions with Python's REPL.  I am
having trouble with tracebacks.  Possibly it is related to buffering (hence
the subject line) but I admit that's a guess.

Why are you doing this in the first place? Why invoke an external Python
shell when you're in a Python program to begin with? Seems terribly
unnecessarily roundabout.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Terry Reedy

On 12/15/2012 9:59 PM, Gene Heskett wrote:


This is 2.6, on ubuntu-10.04.4 LTS



gene@lathe:/usr/lib/python2.6/test$ python -m test.regrtest


That should be the right incantation for 2.6.


test_grammar
test_grammar skipped -- No module named test_grammar
test_opcodes
test_opcodes skipped -- No module named test_opcodes
test_dict
test_dict skipped -- No module named test_dict
test_builtin


You appear to have some of /Lib/test/ present, including 
Lib/test/regrtest.py, but not move of the test_xxx.py files. I do not 
know what is normal for an Ubuntu distribution. On Windows, I believe it 
is all or nothing.



ImportError: cannot import name test_timeout


I have no idea why this one gave an exception rather than a skip.

--
Terry Jan Reedy

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


Re: need some help with unexpected signal exception when using input from a thread (Pypy 1.9.0 on osx/linux)

2012-12-15 Thread Dieter Maurer
Irmen de Jong  writes:

> Using Pypy 1.9.0. Importing readline. Using a background thread to get 
> input() from
> stdin. It then crashes with:
>
>   File "/usr/local/Cellar/pypy/1.9/lib_pypy/pyrepl/unix_console.py", line 
> 400, in restore
> signal.signal(signal.SIGWINCH, self.old_sigwinch)
> ValueError: signal() must be called from the main thread
>
> Anyone seen this before? What's going on?

Apparently, "input" is not apt to be called from a "background thread".

I have no idea why "signal" should only be callable from the main thread.
I do not think this makes much sense. Speak with the "Pypy" developers
about this.

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