Re: difference between random module in python 2.6 and 3.2?

2012-02-06 Thread Steven D'Aprano
On Mon, 06 Feb 2012 02:27:14 -0500, Terry Reedy wrote: [...] >> and should be treated as a bug. Raymond made a strong case arguing for >> repeatability, and then approved a bug fix that broke repeatability. I >> doubt that was deliberate. > > It was deliberate that randrange was changed to an eve

Re: difference between random module in python 2.6 and 3.2?

2012-02-06 Thread Matej Cepl
On 6.2.2012 09:05, Steven D'Aprano wrote: You have persuaded me that the doc should be more explicit that while the basic random.random sequence will be kept repeatable with seed set (except perhaps after a changeover of several releases), the convenience transformations can be changed if improve

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-06 Thread Chris Angelico
On Mon, Feb 6, 2012 at 6:39 PM, Terry Reedy wrote: > On 2/6/2012 1:53 AM, Chris Angelico wrote: >> I suppose there's no chance of moving to a free compiler? > > VC express is free-as-in-beer. The whole V. Studio is free to core > developers. MS may not *like* open-source software, but they have de

Re: difference between random module in python 2.6 and 3.2?

2012-02-06 Thread Matej Cepl
On 6.2.2012 09:45, Matej Cepl wrote: Also, how could I write a re-implementation of random.choice which would work same on python 2.6 and python 3.2? It is not only matter of unit tests, but I would really welcome if the results on both versions produce the same results. Silly, of course, the s

Re: Python and TAP

2012-02-06 Thread Frank Becker
On 06.02.12 01:58, Matej Cepl wrote: Hi, > I have just finished listening to the FLOSS Weekly podcast #200 > (http://twit.tv/show/floss-weekly/200) on autotest, where I've learned > about the existence of TAP (http://testanything.org/). A standardization > of testing seems to be so obviously The

ANN: eGenix mx Base Distribution 3.2.3 (mxDateTime, mxTextTools, etc.)

2012-02-06 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mx Base Distribution Version 3.2.3 for Python 2.4 - 2.7 Open Source Python extensions providing important and useful services

nested embedding of interpreter

2012-02-06 Thread Eric Frederich
Hello, I work with a 3rd party tool that provides a C API for customization. I created Python bindings for this C API so my customizations are nothing more than this example wrapper code almost verbatim: http://docs.python.org/extending/embedding.html#pure-embedding I have many .c files just

Re: difference between random module in python 2.6 and 3.2?

2012-02-06 Thread Mel Wilson
Steven D'Aprano wrote: > A more explicit note will help, but the basic problem applies: how do you > write deterministic tests given that the random.methods (apart from > random.random itself) can be changed without warning? Biting the bullet would mean supplying your own PRNG, under your control

Re: difference between random module in python 2.6 and 3.2?

2012-02-06 Thread Aaron France
On 02/06/2012 09:57 AM, Matej Cepl wrote: On 6.2.2012 09:45, Matej Cepl wrote: Also, how could I write a re-implementation of random.choice which would work same on python 2.6 and python 3.2? It is not only matter of unit tests, but I would really welcome if the results on both versions produce

Re: difference between random module in python 2.6 and 3.2?

2012-02-06 Thread Tim Chase
On 02/06/12 12:48, Aaron France wrote: On 02/06/2012 09:57 AM, Matej Cepl wrote: Silly, of course, the solution is obvious ... I have just embedded random.choice from 2.6 to my code. Matěj Is the above actually a good idea though? What I understand you're doing is embedding the source from th

Re: nested embedding of interpreter

2012-02-06 Thread Antoine Pitrou
Hello, Eric Frederich gmail.com> writes: > > 1)Is calling Py_Initialize twice correct, or will I run into other problems > down the road? It's fine in practice (spurious calls are ignored). > I am not sure if there is a mechanism to get something called at the end of the > user's session wit

Re: Python and TAP

2012-02-06 Thread Terry Reedy
On 2/6/2012 7:24 AM, Frank Becker wrote: On 06.02.12 01:58, Matej Cepl wrote: I have just finished listening to the FLOSS Weekly podcast #200 (http://twit.tv/show/floss-weekly/200) on autotest, where I've learned about the existence of TAP (http://testanything.org/). A standardization of testi

Re: Python and TAP

2012-02-06 Thread Matej Cepl
On 6.2.2012 21:51, Terry Reedy wrote: The 'TAP standard' is what the Perl TAP module does. There is a pre-draft for an IETF standard. You could ask why Perl people don't care about joining the unittest 'standard'. I don't think it is fair: http://en.wikipedia.org/wiki/Test_Anything_Protocol#Ex

Re: difference between random module in python 2.6 and 3.2?

2012-02-06 Thread Matej Cepl
On 6.2.2012 20:26, Tim Chase wrote: In an ideal world, the code wouldn't have broken backwards compat. However, given the conditions, if Matej is willing to forgo bug-fixes, it's a reasonable solution. The alternate might be to try moving the recent/fixed version into the old project and updating

ctypes pointer

2012-02-06 Thread Nitin Bhargava
Hi, I wish to call a function in c++ dll which returns a unicode array from python. extern "c" { __declspec(dllexport) int test(wchar_t** ppText) { *ppText = new wchar_t[30]; wcscpy(*ppText, L"this is a test"); return 0; } __declspec(dllexport) int FreeString(wc

Re: SnakeScript? (CoffeeScript for Python)

2012-02-06 Thread Michal Hantl
See the link I attached. Ruby-like blocks would be nice too. Implicit returns. Better strings like """My name is #{name}""". -- http://mail.python.org/mailman/listinfo/python-list

convert perl-script for voltcraft voltmeter to python [newbie]

2012-02-06 Thread Jean Dupont
I'd like to read in the output of a voltcraft vc960 voltmeter connected to a usb-port. I found the perl-script below but I'd like to accomplish the same with python: I guess I have to use the module serial but I don't know how I should set the serial parameters so they are the same as in the perl-s

Re: SnakeScript? (CoffeeScript for Python)

2012-02-06 Thread alex23
On Feb 3, 8:42 pm, Matej Cepl wrote: > Ask anybody developing in CoffeeScript/Vala how much they love debugging > when they have to go through different styles of errors, bugs in the > intermediate processes, etc. I develop in CoffeeScript. I love debugging it because _it's just javascript_. CS

Help with COM_error

2012-02-06 Thread John Lay
I am not a programmer, but this past week I have had a crash course in python scripting am have been rather impressed with myself for having written a fairly complicated script that among many other processes reads a database table via SearchCursor, populates a word template via Bookmarks, then sav

Re: SnakeScript? (CoffeeScript for Python)

2012-02-06 Thread bruno.desthuilli...@gmail.com
On Feb 2, 9:23 pm, Michal Hantl wrote: > See the link I attached. > Ruby-like blocks would be nice too. > Implicit returns. > Better strings like """My name is #{name}""". Uhu... Looks like you want Ruby, not Python -- http://mail.python.org/mailman/listinfo/python-list

Re: convert perl-script for voltcraft voltmeter to python [newbie]

2012-02-06 Thread Jean Dupont
As my request might have been too much asked, I have started doing some coding myself. I'm in doubt about the readline statement -which doesn't show anything received- as the meter sends continuously streams of 11 bytes Is there a way to just monitor with python what is arriving at a serial port?

Re: IDLE not setting current directory in its path

2012-02-06 Thread gujax
On Jan 31, 6:12 pm, Terry Reedy wrote: > On 1/31/2012 11:27 AM, gujax wrote: > > > Thanks Terry, > > I see that the issue has been closed by you. > > However, I do not know how to run the patch on my Windows. Do I > > reinstall IDLE? > > Please suggest. I am using Python2.7 > Thank you Terry, The

Re: IDLE not setting current directory in its path

2012-02-06 Thread gujax
On Jan 31, 6:12 pm, Terry Reedy wrote: > On 1/31/2012 11:27 AM,gujaxwrote: > > > Thanks Terry, > > I see that the issue has been closed by you. > > However, I do not know how to run the patch on my Windows. Do I > > reinstall IDLE? > > Please suggest. I am using Python2.7 > Hi Terry, I changed the

Re: copy on write

2012-02-06 Thread Rick Johnson
On Feb 2, 11:28 pm, Chris Angelico wrote: > On Fri, Feb 3, 2012 at 4:04 PM, Steven D'Aprano > > wrote: > > No matter what Python did, somebody would complain. > > +1 > > This is, I think, the ultimate truth of the matter. People would not complain if they did not care. The only useless complaint

Re: convert perl-script for voltcraft voltmeter to python [newbie]

2012-02-06 Thread Terry Reedy
On 2/2/2012 3:57 PM, Jean Dupont wrote: I'd like to read in the output of a voltcraft vc960 voltmeter connected to a usb-port. I found the perl-script below but I'd like to accomplish the same with python: The script below is for an old-fashioned, slow, multiple-pin serial port, not usb. I don

undefined symbol: PyUnicodeUCS4_AsUTF8String

2012-02-06 Thread Cov
I'm attempting to run a python script in Blender (blender3d.org) which is generating an error 8< ~~ File "/home/dave/Apps/blender-2.49b-linux-glibc236-py26- x86_64/.blender/scripts/pantographLib.py", line 1941, in Pen MITER = cairo.LINE_JOIN

pySerial question, setting certain serial parameters [newbie]

2012-02-06 Thread Jean Dupont
I need to set the following options I found in a Perl-script in Python for serial communication with a device (a voltmeter): $port->handshake("none"); $port->rts_active(0); $port->dtr_active(1); I have thus far the following statements but I think it does not set the above parameters correctl

building a dictionary dynamically

2012-02-06 Thread noydb
How do you build a dictionary dynamically? Doesn't seem to be an insert object or anything. So I need an empty dictionary that I then want to populate with values I get from looping through a list and grabbing some properties. So simply, I have (fyi, arcpy = module for interacting with gis data)

Re: PythonWin debugger holds onto global logging objects too long

2012-02-06 Thread Vinay Sajip
On Jan 24, 2:52 pm, Rob Richardson wrote: > I use PythonWin to debug the Python scripts we write.  Our scripts often use > the log2pyloggingpackage.  When running the scripts inside the debugger, we > seem to get oneloggingobject for every time we run the script.  The result is > that after run

os.stat last accessed attribute updating last accessed value

2012-02-06 Thread Python_Junkie
I am trying to obtain the last accessed date. About 50% of the files' attributes were updated such that the file was last accessed when this script touches the file. I was not opening the files Anyone have a thought of why this happened. Python 2.6 on windows xp -- http://mail.python.org/mailm

Re: building a dictionary dynamically

2012-02-06 Thread Richard Thomas
On Feb 4, 6:13 pm, noydb wrote: > How do you build a dictionary dynamically?  Doesn't seem to be an > insert object or anything.  So I need an empty dictionary that I then > want to populate with values I get from looping through a list and > grabbing some properties.  So simply, I have (fyi, arcp

Re: os.stat last accessed attribute updating last accessed value

2012-02-06 Thread Jon Clements
On Feb 4, 9:33 pm, Python_Junkie wrote: > I am trying to obtain the last accessed date.  About 50% of the files' > attributes were updated such that the file was last accessed when this > script touches the file. > I was not opening the files > > Anyone have a thought of why this happened. > > Pyt

Re: building a dictionary dynamically

2012-02-06 Thread Dave Angel
On 02/04/2012 01:13 PM, noydb wrote: How do you build a dictionary dynamically? Doesn't seem to be an insert object or anything. So I need an empty dictionary that I then want to populate with values I get from looping through a list and grabbing some properties. So simply, I have (fyi, arcpy

Re: copy on write

2012-02-06 Thread Wolfram Hinderer
On 3 Feb., 11:47, John O'Hagan wrote: > But isn't it equally true if we say that z = t[1], then t[1] += x is > syntactic sugar for z = z.__iadd__(x)? Why should that fail, if z can handle > it? It's more like syntactic sugar for y = t; z = y.__getitem__(1); z.__iadd__(x); y.__setitem__(1, z)

Visual Studio 2010 Support

2012-02-06 Thread Alec Taylor
PIL, PyCrypto and many other modules require a C compiler and linker. Unfortunately neither install on my computer, with a PATH with the following: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC C:\libraries\MinGW\msys\1.0\bin C:\libraries\MinGW C:\Python27\Scripts Output from G:\pycrypt

Re: Common LISP-style closures with Python

2012-02-06 Thread Rick Johnson
On Feb 3, 6:27 pm, Antti J Ylikoski wrote: > In Python textbooks that I have read, it is usually not mentioned that > we can very easily program Common LISP-style closures with Python.  It > is done as follows: > [...] do my eyes not see nor my ears not hear? a thread about common Lisp and Xan Le

Re: pySerial question, setting certain serial parameters [newbie]

2012-02-06 Thread Chris Rebert
On Sat, Feb 4, 2012 at 4:47 AM, Jean Dupont wrote: > I need to set the following options I found in a Perl-script in Python for > serial communication with a device (a voltmeter): > > $port->handshake("none"); > $port->rts_active(0); > $port->dtr_active(1); > > I have thus far the following  stat

Re: Help about dictionary append

2012-02-06 Thread bruno.desthuilli...@gmail.com
On Feb 5, 4:29 pm, Andrew Berg wrote: > This has nothing to do with dictionaries. If you want to add, delete, or > change items, use a list (or a set if there aren't supposed to be any > duplicates). AND you don't care about ordering... -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie socket help

2012-02-06 Thread loial
OS is Red hat enterprise linux 5.5 and python version is 2.6 On Feb 2, 4:34 pm, Dennis Lee Bieber wrote: > On Thu, 2 Feb 2012 05:53:22 -0800 (PST), loial > wrote: > > >I am trying to write a python script to read data from a printer port > >using python sockets, but it seems I am locking up th

Re: undefined symbol: PyUnicodeUCS4_AsUTF8String

2012-02-06 Thread Miki Tebeka
IIRC it means that cairo was compiled against a Python compiled with --enable-unicode=ucs4. But the version of Python you have was not (default is ucs2). Maybe you can find a different version/packaging of cairo that matches this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with COM_error

2012-02-06 Thread Mark Hammond
Unfortunately this just means that Word threw an error and it's not giving many details about what that might be. Are you sure out_TOC is valid on the other computer? eg, http://stackoverflow.com/questions/3730428/why-cant-i-save-as-an-excel-file-from-my-python-code indicates Office fails in

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-06 Thread casevh
On Feb 5, 6:40 am, Alec Taylor wrote: > PIL, PyCrypto and many other modules require a C compiler and linker. > > Unfortunately neither install on my computer, with a PATH with the following: > > C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC > C:\libraries\MinGW\msys\1.0\bin > C:\librarie

Re: Http post and http get

2012-02-06 Thread n3d!m
Cookies work because I am able to login on website and GET other pages. -- http://mail.python.org/mailman/listinfo/python-list

how to read serial stream of data [newbie]

2012-02-06 Thread Jean Dupont
I'd like to read in a stream of data which looks like this: the device sends out a byte-string of 11 bytes roughly every second: B0B0B0B0B03131B0B50D8A B0B0B0B0B03131B0B50D8A B0B0B031B63131B0310D8A B0B034B3323432B3310D8A B0B03237B53432B3310D8A . . . As you see every string is

Re: Python and TAP

2012-02-06 Thread alex23
On Feb 6, 10:58 am, Matej Cepl wrote: > I have just finished listening to the FLOSS Weekly podcast #200 > (http://twit.tv/show/floss-weekly/200) on autotest, where I've learned > about the existence of TAP (http://testanything.org/). [...] > What am I missing? Experience? Are you seriously adv

Re: Python and TAP

2012-02-06 Thread alex23
On Feb 7, 8:03 am, Matej Cepl wrote: > On 6.2.2012 21:51, Terry Reedy wrote: > > The 'TAP standard' is what the Perl TAP module does. There is a > > pre-draft for an IETF standard. You could ask why Perl people don't care > > about joining the unittest 'standard'. > > I don't think it is > fair:h

Re: building a dictionary dynamically

2012-02-06 Thread alex23
On Feb 5, 4:13 am, noydb wrote: > How do you build a dictionary dynamically? > >>> inDict = {} > >>> for inFC in inFClist: > >>>     print inFC > >>>     inCount =  int(arcpy.GetCount_management(inFC).getOutput(0)) > > where I want to make a dictionary like {inFC: inCount, inFC: > inCount, } >

Re: how to read serial stream of data [newbie]

2012-02-06 Thread Roy Smith
In article , Jean Dupont wrote: > I'd like to read in a stream of data which looks like this: > the device sends out a byte-string of 11 bytes roughly every second: > > B0B0B0B0B03131B0B50D8A > B0B0B0B0B03131B0B50D8A > B0B0B031B63131B0310D8A > B0B034B3323432B3310D8A > B0B03

Re: building a dictionary dynamically

2012-02-06 Thread Terry Reedy
On 2/6/2012 11:10 AM, noydb wrote: Adding to dictionaries just isn't obvious... if it's not dict.Add or dict.Appaned or the like, not obvious to inexperienced me! Have you read section 4.8-mapping types, of the library manual? Or help(dict) at the interactive prompt? -- Terry Jan Reedy -- htt