Re: import sqlite3

2009-06-03 Thread Andrew McNamara
On 04/06/2009, at 4:14 PM, willgun wrote: What did you call the .py file? sqlite3.py? If so, you've just imported your own module again. 8-) After the import, try "print sqlite3.__file__", which will tell you where the module came from. Thank you all the same. I'm a student from China.It'

Re: Generating all combinations

2009-06-03 Thread Raymond Hettinger
> Nice one! It only does partitions of a sequence. I haven't yet looked at a way to do partitions of a set. Any ideas? > Raymond, as perhaps *the* principle contributor to itertools, do you feel > that the combinatorics-related tools should be in their own module? Or is > that dividing the mod

Re: how to get rid of pyc files ?

2009-06-03 Thread Gabriel Genellina
[please keep the discussion on the list] may be python need a parameter to regenerate .pyo/pyc explicit ,not depending on magic number and modification time. but i just wander if you simply just clear all .pyc than generate in one system manually, can than program run without error in another s

Re: import sqlite3

2009-06-03 Thread willgun
Andrew McNamara 写道: On 04/06/2009, at 3:15 PM, willgun wrote: When i run the following in IDLE: IDLE 2.6.1 import sqlite3 con =sqlite3.connect (r'g:\db1') everything goes well,but when i save these to a .py file and run it: Traceback (most recent call last): File "C:\Users\hp\Desktop\S

Re: import sqlite3

2009-06-03 Thread willgun
Gabriel Genellina 写道: En Thu, 04 Jun 2009 02:15:39 -0300, willgun escribió: Traceback (most recent call last): File "C:\Users\hp\Desktop\SQLite3\sqlite3.py", line 2, in import sqlite3 File "C:\Users\hp\Desktop\SQLite3\sqlite3.py", line 3, in con=sqlite3.connect(r'g:\db1') Attribu

Re: import sqlite3

2009-06-03 Thread Andrew McNamara
On 04/06/2009, at 3:15 PM, willgun wrote: When i run the following in IDLE: IDLE 2.6.1 import sqlite3 con =sqlite3.connect (r'g:\db1') everything goes well,but when i save these to a .py file and run it: Traceback (most recent call last): File "C:\Users\hp\Desktop\SQLite3\sqlite3.py", l

Re: import sqlite3

2009-06-03 Thread Gabriel Genellina
En Thu, 04 Jun 2009 02:15:39 -0300, willgun escribió: Traceback (most recent call last): File "C:\Users\hp\Desktop\SQLite3\sqlite3.py", line 2, in import sqlite3 File "C:\Users\hp\Desktop\SQLite3\sqlite3.py", line 3, in con=sqlite3.connect(r'g:\db1') AttributeError: 'module' objec

import sqlite3

2009-06-03 Thread willgun
Hi,everyone! When i run the following in IDLE: IDLE 2.6.1 >>> import sqlite3 >>> con =sqlite3.connect (r'g:\db1') >>> everything goes well,but when i save these to a .py file and run it: >>> Traceback (most recent call last): File "C:\Users\hp\Desktop\SQLite3\sqlite3.py", line 2, in import

Re: Project source code layout?

2009-06-03 Thread Allen Fowler
> > I'm new to Python, and am looking for some suggestions as to the source > > code layout for a new project. > > Is this the development layout or the deployment layout? The two need not > bear any resemblance. > Looking for suggestions on both. I was hoping to keep the dev layout as clo

Re: Generating all combinations

2009-06-03 Thread Mensanator
On Jun 3, 10:53�pm, Steven D'Aprano wrote: > On Wed, 03 Jun 2009 18:21:37 -0700, Mensanator wrote: > > [mass snippage] > Settle down Mensanator! Don't take it so personally! You're sounding > awfully agitated. Don't worry, I'm not. > > Now that I've narrowed down what you actually meant, I'm ha

Re: Project source code layout?

2009-06-03 Thread Lawrence D'Oliveiro
In message , Allen Fowler wrote: > I'm new to Python, and am looking for some suggestions as to the source > code layout for a new project. Is this the development layout or the deployment layout? The two need not bear any resemblance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating all combinations

2009-06-03 Thread Steven D'Aprano
On Wed, 03 Jun 2009 18:21:37 -0700, Mensanator wrote: [mass snippage] > What I *was* talking about is this quote from the 3.1 What's New page: > > > The itertools.combinations_with_replacement() function is one of four > for generating combinatorics including permutations and Cartesian > product

Re: OT: Can;'t find a Mozilla user group

2009-06-03 Thread Matt Nordhoff
Anthra Norell wrote: > I can't run Firefox and Thunderbird without getting these upgrade > ordering windows. I don't touch them, because I have reason to suspect > that they are some (Russian) virus that hijacks my traffic. Occasionally > one of these window pops up the very moment I hit a key and

Re: Generating all combinations

2009-06-03 Thread Steven D'Aprano
On Wed, 03 Jun 2009 20:27:56 -0700, Raymond Hettinger wrote: >> > What, no partitions? >> >> >http://en.wikipedia.org/wiki/Partition_of_a_set > > Simpler version: > > def partition(s): > n = len(s) > parts = range(1, n) > for i in range(n): > for div in combinations(parts, i)

Re: Generating all combinations

2009-06-03 Thread Raymond Hettinger
> > What, no partitions? > > >http://en.wikipedia.org/wiki/Partition_of_a_set Simpler version: def partition(s): n = len(s) parts = range(1, n) for i in range(n): for div in combinations(parts, i): print map(s.__getslice__, chain([0], div), chain(div, [n])) >>> pa

Re: Generating all combinations

2009-06-03 Thread Raymond Hettinger
> What, no partitions? > > http://en.wikipedia.org/wiki/Partition_of_a_set Seems like you could roll your own (using combinations as a starting point): def pairwise(iterable): a, b = tee(iterable) next(b, None) return izip(a, b) def partition(s): n = len(s) for i in range(n):

Re: Generating all combinations

2009-06-03 Thread Mensanator
On Jun 3, 6:57 pm, Steven D'Aprano wrote: > On Mon, 01 Jun 2009 22:20:16 -0700, Mensanator wrote: > >> Are you sure that permutations and combinations are subsets of the > >> Cartesian Product? > > > Sure looks that way (SQL examples): > [snip] > > I couldn't do that if they weren't subsets. > > P

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Esmail
Scott David Daniels wrote: Esmail wrote: ... Tk seems a bit more complex .. but I really don't know much about it and its interface with Python to make any sort of judgments as to which option would be better. This should look pretty easy: Thanks Scott for taking the time to share this code

Re: Absolute imports in Python 2.4

2009-06-03 Thread Steven D'Aprano
On Tue, 02 Jun 2009 02:37:04 -0300, Gabriel Genellina wrote: > En Mon, 01 Jun 2009 21:40:26 -0300, Steven D'Aprano > escribió: > >> I have a package which includes a module which shadows a module in the >> standard library. For example: >> >> package >> +-- __init__.py >> +-- ham.py >> +-- spam.

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Roy Smith
In article , "A. Cavallo" wrote: > On Wednesday 03 June 2009 14:05:35 Roy Smith wrote: > > #include > > int main(int argc, char * argv[]) > > { > > std::cout << "SyntaxError: can't assign to function call"; > > std::cout << endl; > > } > > Ops, > I've forgotten > > a.cpp: In func

Re: unittest - what is the best way to reuse test data?

2009-06-03 Thread Mike
On Thu, Jun 4, 2009 at 11:22 AM, Terry Reedy wrote: > Mike wrote: > > >> >> On Thu, Jun 4, 2009 at 4:40 AM, Terry Reedy > tjre...@udel.edu>> wrote: >> >>Mike wrote: >> >>Hello, >> >>I'm writing an application that needs to fetch a json file from >>a webserver. I'm writ

Re: Generating all combinations

2009-06-03 Thread Steven D'Aprano
On Mon, 01 Jun 2009 22:20:16 -0700, Mensanator wrote: >> Are you sure that permutations and combinations are subsets of the >> Cartesian Product? > > Sure looks that way (SQL examples): [snip] > I couldn't do that if they weren't subsets. Permutations and combinations are arrangements of a singl

Re: Challenge supporting custom deepcopy with inheritance

2009-06-03 Thread Aahz
In article , Michael H. Goldwasser wrote: >On June 2, 2009, Aahz wrote: >>Michael Goldwasser: >>> >>>class A(object): >>>def __init__(self, aTag): >>>self.__aTag = aTag >>>self.__aList = [] >> >>IMO, your problem starts right here. Not only are you using customized

Re: OT: Can;'t find a Mozilla user group

2009-06-03 Thread Terry Reedy
News123 wrote: Anthra Norell wrote: I can't run Firefox and Thunderbird without getting these upgrade ordering windows. I don't touch them, because I have reason to suspect that they are some (Russian) virus that hijacks my traffic. Occasionally one of these window pops up the very moment I hit

Re: unittest - what is the best way to reuse test data?

2009-06-03 Thread Terry Reedy
Mike wrote: On Thu, Jun 4, 2009 at 4:40 AM, Terry Reedy > wrote: Mike wrote: Hello, I'm writing an application that needs to fetch a json file from a webserver. I'm writing the tests and have a question: if I have the following m

Re: Safe to import __builtin__ ?

2009-06-03 Thread Robert Kern
On 2009-06-03 17:54, Steven D'Aprano wrote: On Wed, 03 Jun 2009 18:57:29 +, Benjamin Peterson wrote: mrstevegross gmail.com> writes: Is it generally safe to explicitly import __builtin__ in python? That is, my code reads like this: ... It seems like it should be a safe import, but I

Re: Safe to import __builtin__ ?

2009-06-03 Thread Steven D'Aprano
On Wed, 03 Jun 2009 18:57:29 +, Benjamin Peterson wrote: > mrstevegross gmail.com> writes: > > >> Is it generally safe to explicitly import __builtin__ in python? That >> is, my code reads like this: > ... >> >> It seems like it should be a safe import, but I just want to make sure. > > Y

Re: OT: Can;'t find a Mozilla user group

2009-06-03 Thread News123
Anthra Norell wrote: > I can't run Firefox and Thunderbird without getting these upgrade > ordering windows. I don't touch them, because I have reason to suspect > that they are some (Russian) virus that hijacks my traffic. Occasionally > one of these window pops up the very moment I hit a key an

Re: Safe to import __builtin__ ?

2009-06-03 Thread mrstevegross
> Yes, it's safe (and this is what the ‘__builtin__’ module is intended > for: http://docs.python.org/library/__builtin__>). > > Be careful, though: there's a separate name, ‘__builtins__’, that is > *not* meant to be imported. It's also implementation-specific, so > shouldn't be relied upon. My ad

Re: unittest - what is the best way to reuse test data?

2009-06-03 Thread Mike
On Thu, Jun 4, 2009 at 4:40 AM, Terry Reedy wrote: > Mike wrote: > >> Hello, >> >> I'm writing an application that needs to fetch a json file from a >> webserver. I'm writing the tests and have a question: >> >> if I have the following methods: >> >> def test_headers(self): >>headers = libary

Re: Get the hard disk hardware serial number

2009-06-03 Thread Terry Reedy
Jorge wrote: Hi there, I need to know how to get the hardware serial number of a hard disk in python. That will be system specific. One semi-general approacy using CPython would be to ask "How would I do this with C on this specific system" and then use ctypes. -- http://mail.python.org/

Re: Get the hard disk hardware serial number

2009-06-03 Thread MRAB
Jorge wrote: Hi there, I need to know how to get the hardware serial number of a hard disk in python. Thank you in advance. For Windows, see http://www.daniweb.com/forums/thread187326.html -- http://mail.python.org/mailman/listinfo/python-list

Get the hard disk hardware serial number

2009-06-03 Thread Jorge
Hi there, I need to know how to get the hardware serial number of a hard disk in python. Thank you in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Copying objects and multiple inheritance

2009-06-03 Thread Gabriel Genellina
En Wed, 03 Jun 2009 10:20:35 -0300, Brian Allen Vanderburg II escribió: Gabriel Genellina wrote: En Tue, 02 Jun 2009 19:02:47 -0300, Brian Allen Vanderburg II escribió: What is the best way to copy an object that has multiple inheritance with the copy module. Particularly, some of the i

Re: Challenge supporting custom deepcopy with inheritance

2009-06-03 Thread Michael H . Goldwasser
On June 2, 2009, Aahz wrote: >>class A(object): >>def __init__(self, aTag): >>self.__aTag = aTag >>self.__aList = [] > >IMO, your problem starts right here. Not only are you using customized >attributes for each class, you're using class-private

accessing the XML attribute value noNamespaceSchemaLocation thru Python 2.5

2009-06-03 Thread tooshiny
I am currently successfully using lxml and ElementTree to validate and to access the XML contained data. I can however not find any functional call to access the schema location ie the attribute value noNamespaceSchemaLocation. A simple function call would be so much nicer than the other route of

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Scott David Daniels
Esmail wrote: ... Tk seems a bit more complex .. but I really don't know much about it and its interface with Python to make any sort of judgments as to which option would be better. This should look pretty easy: import Tkinter as tk class Mover(object): def __init__(self, ca

urllib.FancyURLopener.redirect_internal behavior

2009-06-03 Thread Nick Nobody
Hello, I've recently been playing around with urllib.FancyURLopener and noticed that under certain conditions it can block after calling open() on a url. It only happens on specific servers and when the "Range" HTTP header is in use. The server doesn't close the connection and redirect_intern

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Brian Blais
On Jun 3, 2009, at 12:15 , Esmail wrote: Gökhan SEVER wrote: It seems like you want to animate your data. You may want to take a look at Matplotlib examples or Mayavi for 3D I've used Matplotlib to plot points that were saved during runtime to a file. I wonder if I could skip that step and d

Re: Illegal seek with os.popen

2009-06-03 Thread Aahz
In article <7c93031a-235e-4e13-bd37-7c9dbc6e8...@r16g2000vbn.googlegroups.com>, wrote: >Should I open a bug report for this? > >Python 2.5.1 (r251:54863, Sep 19 2007, 14:58:06) [C] on aix5 >Type "help", "copyright", "credits" or "license" for more information. import os os.popen('cat','

RE: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread esmail bonakdarian
Hi Brian, Thanks for the code sample, that looks quite promising. I can run it and understand most of it - my knowledge of pylab/matplotlib is still quite rudimentary. I wish there was a good manual/tutorial that could be printed off (or for that matter a book) on this as it seems quite cabable a

Re: Missing codecs in Python 3.0

2009-06-03 Thread Benjamin Peterson
samwyse gmail.com> writes: > > I have a Python 2.6 program (a code generator, actually) that tries > several methods of compressing a string and chooses the most compact. > It then writes out something like this: > { encoding='bz2_codec', data = '...'} In 3.x, all codecs which don't directly

Spring Python 1.0.0-RC2 has been released

2009-06-03 Thread Goldfish
Spring Python takes the concepts implemented by the Java-based Spring Framework, and applies them to Python. This provides a powerful library of functionality to help you get back to writing the code that makes you money. It includes features like data access, transaction management, remoting, secu

Project source code layout?

2009-06-03 Thread Allen Fowler
Hello, I'm new to Python, and am looking for some suggestions as to the source code layout for a new project. The project will be a tg/pylons daemon, a static website, and a collection of other scripts that will interact with the app and DB. Here is what I am thinking so far: root_folder/ -

Re: private pypi repository

2009-06-03 Thread kiorky
Aljosa Mohorovic a écrit : i'm looking for a effective way to setup private pypi repository, i've found: - PloneSoftwareCenter - http://code.google.com/p/pypione/ - http://pypi.python.org/pypi/haufe.eggserver what are you using? what would you recommend? Aljosa Mohorovic You have also http://p

Re: Safe to import __builtin__ ?

2009-06-03 Thread Benjamin Peterson
mrstevegross gmail.com> writes: > > Is it generally safe to explicitly import __builtin__ in python? That > is, my code reads like this: ... > > It seems like it should be a safe import, but I just want to make > sure. Yes, that's fine. I'm not sure why you don't just use type(), though. -

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Esmail
ma wrote: Try out PyChart, it's a very complete and has a great interface. I use it to generate statistics for some of our production machines: http://home.gna.org/pychart/ Thanks for the suggestion and link, I'm not familiar with this, but will check it out. If I can get matlibplot to work it

Re: is anyone using text to speech to read python documentation

2009-06-03 Thread Stef Mientki
eric_dex...@msn.com wrote: I wrote a small pre-processor for python documentation and I am looking for advice on how to get the most natural sounding reading. I uploaded an example of a reading of lxml documentation as a podcast1 http://dexrow.blogspot.com/2009/06/python-voice-preprocessor

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Esmail
Mensanator wrote: On Jun 3, 10:53 am, Esmail wrote: Hi all, I am trying to visualize a number of small objects moving over a 2D surface during run-time. I was wondering what would the easiest way to accomplish this using Python? Try Turtle Graphics using goto's. With pen up! :-) hehe .. ye

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Carl Banks
On Jun 3, 2:13 am, Lawrence D'Oliveiro wrote: > In message c0e4-479a-85ed-91c26d3bf...@c36g2000yqn.googlegroups.com>, Kay Schluehr > wrote: > > > > > > > On 3 Jun., 05:51, Lawrence D'Oliveiro > central.gen.new_zealand> wrote: > > >> In message , Sebastian Wiesner wrote: > > >> > > > >> >> That

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Mensanator
On Jun 3, 10:53 am, Esmail wrote: > Hi all, > > I am trying to visualize a number of small objects moving over > a 2D surface during run-time. I was wondering what would the easiest > way to accomplish this using Python? Try Turtle Graphics using goto's. With pen up! :-) > Ideally I am looking f

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread ma
Try out PyChart, it's a very complete and has a great interface. I use it to generate statistics for some of our production machines: http://home.gna.org/pychart/ On Wed, Jun 3, 2009 at 1:28 PM, Esmail wrote: > Gökhan SEVER wrote: >> >> I don't know how easy to use pygame or pyOpenGL for data ani

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Esmail
Gökhan SEVER wrote: I don't know how easy to use pygame or pyOpenGL for data animation comparing to Mayavi. Mayavi uses VTK as its visualization engine which is an OpenGL based library. I would like to learn more about how alternative tools might be beneficial say for example atmospheric part

Re: private pypi repository

2009-06-03 Thread Diez B. Roggisch
Aljosa Mohorovic wrote: > i'm looking for a effective way to setup private pypi repository, i've > found: > - PloneSoftwareCenter > - http://code.google.com/p/pypione/ > - http://pypi.python.org/pypi/haufe.eggserver > > what are you using? what would you recommend? We use eggbasket [1], in an ac

Re: How do I change the behavior of the 'python-docs' action in IDLE?

2009-06-03 Thread Terry Reedy
Aahz wrote: In article <16b92b10-95cf-49ed-868c-8f66c8160...@r3g2000vbp.googlegroups.com>, samwyse wrote: I just installed Python 3.0.1 via the Windows 32-bit installer. Opening "Python Docs" takes me to http://docs.python.org/dev/3.0/, which doesn't exist. Renaming python301.chm to python30.

Re: unittest - what is the best way to reuse test data?

2009-06-03 Thread Terry Reedy
Mike wrote: Hello, I'm writing an application that needs to fetch a json file from a webserver. I'm writing the tests and have a question: if I have the following methods: def test_headers(self): headers = libary.get_data(data) check header status With no json experience specifical

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Terry Reedy
A. Cavallo wrote: print [ x*2 for range(10) in data if (x%2 == 0) ] I hope you meant print [ x*2 for x in range(10) if (x%2 == 0) ] -- http://mail.python.org/mailman/listinfo/python-list

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Gökhan SEVER
I don't know how easy to use pygame or pyOpenGL for data animation comparing to Mayavi. Mayavi uses VTK as its visualization engine which is an OpenGL based library. I would like to learn more about how alternative tools might be beneficial say for example atmospheric particle simulation or realis

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Esmail
Hello Diez, Diez B. Roggisch wrote: pygame certainly suited, but also Tk with it's canvas-object. I used pygame a long time ago, barely remember it, but I think it was pretty easy to use. Tk seems a bit more complex .. but I really don't know much about it and its interface with Python to ma

private pypi repository

2009-06-03 Thread Aljosa Mohorovic
i'm looking for a effective way to setup private pypi repository, i've found: - PloneSoftwareCenter - http://code.google.com/p/pypione/ - http://pypi.python.org/pypi/haufe.eggserver what are you using? what would you recommend? Aljosa Mohorovic -- http://mail.python.org/mailman/listinfo/python-l

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Esmail
Gökhan SEVER wrote: It seems like you want to animate your data. You may want to take a look at Matplotlib examples or Mayavi for 3D I've used Matplotlib to plot points that were saved during runtime to a file. I wonder if I could skip that step and directly plot during runtime updating the g

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Gökhan SEVER
It seems like you want to animate your data. You may want to take a look at Matplotlib examples or Mayavi for 3D animations ( http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab_animating.html?highlight=animation ) Gökhan On Wed, Jun 3, 2009 at 10:53 AM, Esmail wrote:

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Diez B. Roggisch
Esmail wrote: > Hi all, > > I am trying to visualize a number of small objects moving over > a 2D surface during run-time. I was wondering what would the easiest > way to accomplish this using Python? Ideally I am looking for a shallow > learning curve and efficient implementation :-) > > These

Re: How do I change the behavior of the 'python-docs' action in IDLE?

2009-06-03 Thread Aahz
In article <16b92b10-95cf-49ed-868c-8f66c8160...@r3g2000vbp.googlegroups.com>, samwyse wrote: > >I just installed Python 3.0.1 via the Windows 32-bit installer. >Opening "Python Docs" takes me to http://docs.python.org/dev/3.0/, >which doesn't exist. Renaming python301.chm to python30.chm or >py

easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Esmail
Hi all, I am trying to visualize a number of small objects moving over a 2D surface during run-time. I was wondering what would the easiest way to accomplish this using Python? Ideally I am looking for a shallow learning curve and efficient implementation :-) These objects may be graphically rep

Re: float("1,009.67") error

2009-06-03 Thread Chris Rebert
On Wed, Jun 3, 2009 at 8:29 AM, Jianli Shen wrote: > I want to converter a string 1,009.67 to float, I got: > python ValueError: invalid literal for float() > how do I handle this. > > 1,009.67 is generated by some other program. It could be 2,898.88 > 3,554,545.66 etc. Python's literal float syn

ANN: Resolver One 1.5 released

2009-06-03 Thread Giles Thomas
We are proud to announce the release of Resolver One, version 1.5. Resolver One is a Windows-based spreadsheet that integrates Python deeply into its recalculation loop, making the models you build more reliable and more maintainable. For version 1.5, we've added a console; this new command-line w

float("1,009.67") error

2009-06-03 Thread Jianli Shen
I want to converter a string 1,009.67 to float, I got: python ValueError: invalid literal for float() how do I handle this. 1,009.67 is generated by some other program. It could be 2,898.88 3,554,545.66 etc. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: Python reimport

2009-06-03 Thread peteshinners
On Jun 2, 11:54 pm, Ben Finney wrote: > When making an announcement of a new version of a project, please > summarise in the announcement what that project is (i.e. what the > program does) This module has a reimport function that works as a replacement for the reload builtin. It does a respectab

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Lou Pecora
In article , Lawrence D'Oliveiro wrote: > In message , Sebastian Wiesner wrote: > > > > > > >> That said I've used C++ with ctypes loads of times, but I always wrap > >> the exported stuff in extern "C" { } blocks. > > > > No wonder, you have never actually used C++ with C types. An extern

Re: is anyone using text to speech to read python documentation

2009-06-03 Thread edexter
On Jun 2, 7:52 pm, "eric_dex...@msn.com" wrote: >      I wrote a small pre-processor for python documentation and I am > looking for advice on how to get the most natural sounding reading.  I > uploaded an example of a reading of lxml documentation as a podcast1 > > http://dexrow.blogspot.com/2009

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread A. Cavallo
On Wednesday 03 June 2009 14:05:35 Roy Smith wrote: > #include > int main(int argc, char * argv[]) > { > std::cout << "SyntaxError: can't assign to function call"; > std::cout << endl; > } Ops, I've forgotten a.cpp: In function ‘int main(int, char**)’: a.cpp:5: error: ‘endl’ was not

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread A. Cavallo
On Wednesday 03 June 2009 14:05:35 Roy Smith wrote: > In article , > > "A. Cavallo" wrote: > > The following is the STL equivalent of: > > > > print [ x*2 for range(10) in data if (x%2 == 0) ] > > Are you sure about that? I haven't tested the following code, but I > believe it is a much more dir

Re: Copying objects and multiple inheritance

2009-06-03 Thread Brian Allen Vanderburg II
Gabriel Genellina wrote: En Tue, 02 Jun 2009 19:02:47 -0300, Brian Allen Vanderburg II escribió: What is the best way to copy an object that has multiple inheritance with the copy module. Particularly, some of the instances in the hierarchy ("...some of the classes in...", I presume?) us

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Roy Smith
In article , "A. Cavallo" wrote: > The following is the STL equivalent of: > > print [ x*2 for range(10) in data if (x%2 == 0) ] Are you sure about that? I haven't tested the following code, but I believe it is a much more direct match the the behavior of your Python code (at least on Pytho

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Kay Schluehr
On 3 Jun., 11:13, Lawrence D'Oliveiro wrote: > In message c0e4-479a-85ed-91c26d3bf...@c36g2000yqn.googlegroups.com>, Kay Schluehr > wrote: > > > > > On 3 Jun., 05:51, Lawrence D'Oliveiro > central.gen.new_zealand> wrote: > > >> In message , Sebastian Wiesner wrote: > > >> > > > >> >> That said

Re: How to get a window ID in linux using python?

2009-06-03 Thread Paul Boddie
On 3 Jun, 10:58, "Martin v. Löwis" wrote: > > In Linux, we can get window info by executing 'xwininfo' and then > > selecting the desired window manually. Can this be done automatically > > in python? > > You can run "xwininfo -tree -root", and then parse the output. The desktop.windows module pr

OT: Can;'t find a Mozilla user group

2009-06-03 Thread Anthra Norell
I can't run Firefox and Thunderbird without getting these upgrade ordering windows. I don't touch them, because I have reason to suspect that they are some (Russian) virus that hijacks my traffic. Occasionally one of these window pops up the very moment I hit a key and next a confirmation messa

Re: why does my python's program die after change computer system time?

2009-06-03 Thread Gabriel Genellina
En Wed, 03 Jun 2009 04:08:03 -0300, fuzziy escribió: [why does my python's program die after change computer system time?] def tick(): ...show current time... clock_label.after(200, tick) What do you mean by "die"? Did you set the system time to an earlier value? Suppose now it i

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread A. Cavallo
> >> > No wonder, you have never actually used C++ with C types. An extern > >> > "C" clause tells the compiler to generate C functions (more precisely, > >> > functions that conform to the C ABI conventions), so effectively > >> > you're calling into C, not into C++. > >> > >> Seems like the only

unittest - what is the best way to reuse test data?

2009-06-03 Thread Mike
Hello, I'm writing an application that needs to fetch a json file from a webserver. I'm writing the tests and have a question: if I have the following methods: def test_headers(self): headers = libary.get_data(data) check header status def test_get_info info = libary.get_info(libary

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Lawrence D'Oliveiro
In message , Kay Schluehr wrote: > On 3 Jun., 05:51, Lawrence D'Oliveiro central.gen.new_zealand> wrote: > >> In message , Sebastian Wiesner wrote: >> >> > >> >> >> That said I've used C++ with ctypes loads of times, but I always wrap >> >> the exported stuff in extern "C" { } blocks. >> >> > N

Re: How to get a window ID in linux using python?

2009-06-03 Thread Martin v. Löwis
> In Linux, we can get window info by executing 'xwininfo' and then > selecting the desired window manually. Can this be done automatically > in python? You can run "xwininfo -tree -root", and then parse the output. HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list

why does my python's program die after change computer system time?

2009-06-03 Thread fuzziy
Microsoft windowsXP 中,在python2.6下运行如下程序,显示一个时间的窗口。当双击桌面右下角的时间,然后更改时间或日 期,多次更改后,我的时间窗口就死机了,时间不变了。好像是after(200, tick)不运行了。不知道为怎么这个定时器会死掉呢。请各位指教, 谢谢!! import Tkinter import time curtime = '' clock_label = Tkinter.Label() clock_label.pack() def tick(): global curtime #print("1:") newtime

How to get a window ID in linux using python?

2009-06-03 Thread Sandy
Hi all, Is there a way to get window ID in linux using python by just using the window name (say 'VPython')? This can be done in (Microsoft) windows (got it from somewhere else, not tested). import win32gui self.VP = win32gui.FindWindow ( None, 'VPython' ) In Linux, we can get window info

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Diez B. Roggisch
A. Cavallo schrieb: Mmmm, not really a conspiracy but it is not that trivial In wrapping c++ you might find useful the commands nm with c++filt although they work under linux there is the same pair for every platform (under windows I remember there is objdump): they should only you need to

Re: FILE object in Python3.0 extension modules

2009-06-03 Thread Martin v. Löwis
> The purpose is to dump the contents of a Python extension type to disk > as binary data using C's fwrite() function. This isn't really possible anymore - the Python IO library has stopped using stdio. There are a couple of alternatives: 1. don't use fwrite(3) to write the binary data, but inste

Re: Problem building 64-bit python 2.6.2 on Solaris 10

2009-06-03 Thread Martin v. Löwis
> I was able to compile ctypes with gcc4sparc without many changes to > the CFLAGS, etc. I had another weird error, but upgrading to the > latest gcc4sparc fixed it. One thing I'm not clear about is how > extensions are built. I noticed that my CFLAGS are not being passed > to gcc when building

Re: Python reimport

2009-06-03 Thread Ben Finney
peteshinners writes: > I've implemented a working reimport that, "does what you want". After > a bit of testing with friends, I'm releasing version 1.0 tonight. When making an announcement of a new version of a project, please summarise in the announcement what that project is (i.e. what the pro