Re: Python bindings tutorial

2010-03-19 Thread Alf P. Steinbach
* Tim Roberts: Dave Angel wrote: There's no real reason parts of an exe cannot be exported, same as a dll. They are in fact the same structure. And in fact many other files in the Windows environment are also the same structure, from fonts to ocx's This is a bit off-topic, but your explan

Re: sqlite3, memory db and multithreading

2010-03-19 Thread Expo
On Mar 18, 1:58 pm, królewna wrote: > The problem is simple: I have multiple threads within one program. At > least 2 threads have to have access to in-memory sqlite database. It is > not possible to pass sqlite objects to those threads because an > exception is rised: > > ProgrammingError: SQLite

Re:Re: C++ code generation

2010-03-19 Thread CHEN Guang
Plug? Any evidence to say that? As long as this thread concerned, is there any answer more closed to the topic "C++ code generation" than mine? I think Stefan was telling you, in a nice way, to stop spamming every thread about code generation with a plug for your project. 2010/3/17 CHEN Guan

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Peter Otten
Hellmut Weber wrote: > your hack is exactly what I was looking for. > It permits to configure my logging messages as I want, e.g. using > different colors for different classes of messages. > > I do not yet understand all details WHY it is working but suppose some > study of the logging module wi

installing something to a virtualenv when it's already in site-packages

2010-03-19 Thread nbv4
I have ipython installed via apt. I can go to the command line and type 'ipython' and it will work. If I try to install ipython to a virtualenv, I get this: $ pip install -E env/ ipython Requirement already satisfied: ipython in /usr/share/pyshared Installing collected packages: ipython Successful

Re: installing something to a virtualenv when it's already in site-packages

2010-03-19 Thread Rolando Espinoza La Fuente
On Fri, Mar 19, 2010 at 4:05 AM, nbv4 wrote: > I have ipython installed via apt. I can go to the command line and > type 'ipython' and it will work. If I try to install ipython to a > virtualenv, I get this: > > $ pip install -E env/ ipython > Requirement already satisfied: ipython in /usr/share/p

exp_continue

2010-03-19 Thread Pankaj
I am using pexpect module in python I would like to know how I can use exp_continue here. what is the alternative of exp_continue of perl/tcl in pexpect. -- http://mail.python.org/mailman/listinfo/python-list

Why this compile error?

2010-03-19 Thread Jimbo
Hello Can you help me figure out why I am getting this compile error with my program. The error occurs right at the bottom of my code & I have commented where it occurs. The error is: [QUOTE]Expected an indented block[/QUOTE] [CODE]""" *Stock Data Builder* Algorithm: - Search website f

Re: Why this compile error?

2010-03-19 Thread Bruno Desthuilliers
Jimbo a écrit : Hello Can you help me figure out why I am getting this compile error with my program. The error occurs right at the bottom of my code & I have commented where it occurs. The error is: [QUOTE]Expected an indented block[/QUOTE] [CODE] (snip) # Main program loop def main():

Re: Why this compile error?

2010-03-19 Thread Ulrich Eckhardt
Jimbo wrote: > Can you help me figure out why I am getting this compile error with my > program. The error occurs right at the bottom of my code & I have > commented where it occurs. [...] > def main(): > programEnd = False; > > while (programEnd == False): > #ERROR HERE?? - Error=

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Jean-Michel Pichavant
Hellmut Weber wrote: Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT when I have to wrap the logger call in some other function, I always ge

Importing modules

2010-03-19 Thread Peyman Askari
I want to write a function which imports modules the first time, and reloads them afterwards, but I am running into problems with global variables and exec. I will include a full script, but let me elaborate first. Essentially what you need is def import_or_reload():  """assume we want to load

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 18.03.2010 15:49, DreiJane pisze: Principally sqlite connections (sqlite3 objects in the C-API) can be used over multiple threads - and connections to :memory: make no difference. There are additional parameters to open() giving fine- tuned control. And apsw is promising a true reflection

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 18.03.2010 23:06, Aahz pisze: You probably need to serialize access to the database through one thread. sqlite3 objects are not pickable so it's not proper way. -- best regards princess -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 19.03.2010 08:20, Expo pisze: You can put the SQLite database into a Singleton class and use a semaphore to serialize the access to methods which writes to the database. I've tried this out but doesnt work. Still gives an error like: ProgrammingError: SQLite objects created in a thread

Re: sqlite3, memory db and multithreading

2010-03-19 Thread Tim Golden
On 19/03/2010 10:56, królewna wrote: W dniu 18.03.2010 23:06, Aahz pisze: You probably need to serialize access to the database through one thread. sqlite3 objects are not pickable so it's not proper way. Is it possible you've misunderstood the meaning of the word "serialize" here? What's b

Re: sqlite3, memory db and multithreading

2010-03-19 Thread królewna
W dniu 19.03.2010 12:10, Tim Golden pisze: Is it possible you've misunderstood the meaning of the word "serialize" here? It's not possible, it just happened :) What's being suggested isn't serialising (ie marshalling, pickling) the data; rather, serialising the *access*, ie pushing all db requ

python-daemon PID file

2010-03-19 Thread Kamil Wasilewski
Hi all, Im trying to get a daemon up and running but have been tripping on every stone along the way, this last one however i cant manage to get by. versions: Python 2.5.2 python-daemon-1.5.5 Debian Linux 2.6.26-2-686 Some of the problems ive run into: import daemon with daemon.DaemonContext():

Re: should writing Unicode files be so slow

2010-03-19 Thread djc
Ben Finney wrote: > djc writes: > >> I have a simple program to read a text (.csv) file > > Could you please: > > * simplify it further: make a minimal version that demonstrates the > difference you're seeing, without any extraneous stuff that doesn't > appear to affect the result. > > * m

Re: Importing modules

2010-03-19 Thread Dave Angel
Peyman Askari wrote: I want to write a function which imports modules the first time, and reloads them afterwards, but I am running into problems with global variables and exec. I will include a full script, but let me elaborate first. Essentially what you need is def import_or_reload(): "

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Peter Otten
Jean-Michel Pichavant wrote: > Hellmut Weber wrote: >> Am 11.03.2010 12:14, schrieb Peter Otten: >>> Hellmut Weber wrote: >>> Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT when I have to w

Re: should writing Unicode files be so slow

2010-03-19 Thread Ben Finney
djc writes: > Ben Finney wrote: > > Could you please: > > > > * simplify it further: make a minimal version that demonstrates the > > difference you're seeing, without any extraneous stuff that doesn't > > appear to affect the result. > > > > * make it complete: the code you've shown doesn'

Re: C-API PyObject_Call

2010-03-19 Thread moerchendiser2k3
In my case I call a funcion and I would like to get the line where the function returned. for instance: def my_function(): return 3 So I would like to get line 2(in C) somehow. -- http://mail.python.org/mailman/listinfo/python-list

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Jean-Michel Pichavant
Peter Otten wrote: Jean-Michel Pichavant wrote: Hellmut Weber wrote: Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT

Re: SOLUTION

2010-03-19 Thread królewna
I have found the solution. I dont know why in python documentation there is not a single word about this option. I've found it in pysqlite doc site. So we have to add a new keyword argument to connection function and we will be able to create cursors out of it in different thread. So use: sqli

Re: C-API PyObject_Call

2010-03-19 Thread Stefan Behnel
moerchendiser2k3, 19.03.2010 14:12: In my case I call a funcion and I would like to get the line where the function returned. for instance: def my_function(): return 3 So I would like to get line 2(in C) somehow. Ok, so you're looking for the C-level trace function in CPython, I guess.

What is pkg-config for ?

2010-03-19 Thread Johny
Can anyone explain what is pkg-config for?ANd how can I find it in Windows? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Importing v reloading modules modules

2010-03-19 Thread Peter Peyman Puk
Hello I submitted this earlier today, but I was not clear enough, so I am posting it again. I am running a simulator written in python. The simulator has a small TextView (actually a SourceView) widget which lets the user writes scripts, and when they are satisfied they can execute that s

Re: should writing Unicode files be so slow

2010-03-19 Thread djc
Ben Finney wrote: > What happens, then, when you make a smaller program that deals with only > one file? > > What happens when you make a smaller program that only reads the file, > and doesn't write any? Or a different program that only writes a file, > and doesn't read any? > > It's these sort

[python3]

2010-03-19 Thread Kevin Adams
Greetings! Please forgive me if im posting this to the wrong group. I'm new to Python, learning Python3 from the O'rielly "Learning Python" book. Reading about operator overloading, specifically __getitem__. I put together a small bit of code to do some experimenting and threw in a timer so i

Re: Importing v reloading modules modules

2010-03-19 Thread Terry Reedy
Reload is effectively deprecated in 2.x and removed in 3.x, so I recommend not using it. Deleting an entry from sys.modules should force recreation with an import. Just make sure all other references are also gone so that the module object can be deleted. The following shows how to import by

Re: [python3]

2010-03-19 Thread Steve Holden
Kevin Adams wrote: > Greetings! > > Please forgive me if im posting this to the wrong group. > > I'm new to Python, learning Python3 from the O'rielly "Learning > Python" book. Reading > about operator overloading, specifically __getitem__. I put together > a small bit of code to > do some exp

Re: [python3]

2010-03-19 Thread Krister Svanlund
On Fri, Mar 19, 2010 at 6:42 PM, Kevin Adams wrote: > Greetings! > > Please forgive me if im posting this to the wrong group. > > I'm new to Python, learning Python3 from the O'rielly "Learning > Python" book.  Reading > about operator overloading, specifically __getitem__.   I put together > a sm

Re: [python3]

2010-03-19 Thread Terry Reedy
On 3/19/2010 1:42 PM, Kevin Adams wrote: Please forgive me if im posting this to the wrong group. Just the right place. I would suggest a more informative title in the future though. 'Problem with print and sleep.', for instance. I'm new to Python, learning Python3 from the O'rielly "Lear

Re: [python3]

2010-03-19 Thread Kevin Adams
On Mar 19, 2:21 pm, Terry Reedy wrote: > On 3/19/2010 1:42 PM, Kevin Adams wrote: > > > Please forgive me if im posting this to the wrong group. > > Just the right place. I would suggest a more informative title in the > future though. 'Problem with print and sleep.', for instance. > > > > > I'm n

Reserving binary Buffer for struct.pack_into() of exact length

2010-03-19 Thread Hans Müller
Hello, I need some buffers, which are beeing concatenated an then send via the socket() function. My problem is that create_string_buffer() creates a buffer which ist one byte too long (for a \0 char). But when I concatenate some of these buffers to a long one to be transfered, the extra byte

Re: [python3]

2010-03-19 Thread Terry Reedy
On 3/19/2010 2:17 PM, Steve Holden wrote: Kevin Adams wrote: Greetings! Please forgive me if im posting this to the wrong group. I'm new to Python, learning Python3 from the O'rielly "Learning Python" book. Reading about operator overloading, specifically __getitem__. I put together a small

Re: Reserving binary Buffer for struct.pack_into() of exact length

2010-03-19 Thread Emile van Sebille
On 3/19/2010 11:46 AM Hans Müller said... Hello, I need some buffers, which are beeing concatenated an then send via the socket() function. My problem is that create_string_buffer() creates a buffer which ist one byte too long (for a \0 char). But when I concatenate some of these buffers to a lo

"Sexy Girls" "Sexy Indian Girls" "Sexy USA Girls" "Sexy RUSSIAN Girls" "Sexy PAKISTANI Girls" "Sexy CHINESE Girls" "Sexy THAI Girls" "Sexy JAPANESE Girls" "Sexy KOREAN Girls" "Sexy MODEL Girls" ON

2010-03-19 Thread saima81
"Sexy Girls" "Sexy Indian Girls" "Sexy USA Girls" "Sexy RUSSIAN Girls" "Sexy PAKISTANI Girls" "Sexy CHINESE Girls" "Sexy THAI Girls" "Sexy JAPANESE Girls" "Sexy KOREAN Girls" "Sexy MODEL Girls" ON www.sexyandpretty-girls.blogspot.com "Sexy Girls" "Sexy Indian Girls" "Sexy USA Girls" "S

Re: Truoble With A Search Script for ImageBin.org

2010-03-19 Thread Brandon C
*grumble* *grumble* *grumble* oops, sorry ... my mistake it turns out that i misspelled one of the values and left another one out. here's the working script now for anyone who may care: import urllib import urllib2 url = 'http://imagebin.org/index.php?page=search' values = {'search_for' : 'bla

Re: What is pkg-config for ?

2010-03-19 Thread Gabriel Genellina
En Fri, 19 Mar 2010 12:32:32 -0300, Johny escribió: Can anyone explain what is pkg-config for?ANd how can I find it in Windows? Go to http://www.google.com/ Enter "pkg-config windows" (without quotes) in the input box. Press the Search button. You'll get this site at the top, or near it: htt

script to upload file using POST form

2010-03-19 Thread Brandon C
got another question for yall wonderful minds; how can i upload a file to a server that uses a POST form? here's the link to the form that i'd like to be able to upload a file: http://imagebin.org/index.php?page=add tks -- http://mail.python.org/mailman/listinfo/python-list

Re: should writing Unicode files be so slow

2010-03-19 Thread Gabriel Genellina
En Fri, 19 Mar 2010 14:18:17 -0300, djc escribió: Ben Finney wrote: What happens, then, when you make a smaller program that deals with only one file? What happens when you make a smaller program that only reads the file, and doesn't write any? Or a different program that only writes a file,

RELEASED Python 2.6.5

2010-03-19 Thread Barry Warsaw
On behalf of the Python community, I'm happy to announce the availability of Python 2.6.5 final. This is the latest production-ready version in the Python 2.6 series. Python 2.6.5 fixes dozens of issues in the core, built-in modules, libraries, and documentation since Python 2.6.4 was released ba

Re: script to upload file using POST form

2010-03-19 Thread Gabriel Genellina
En Fri, 19 Mar 2010 19:02:25 -0300, Brandon C escribió: got another question for yall wonderful minds; how can i upload a file to a server that uses a POST form? here's the link to the form that i'd like to be able to upload a file: http://imagebin.org/index.php?page=add Unfortunately it

Re: should writing Unicode files be so slow

2010-03-19 Thread Ben Finney
"Gabriel Genellina" writes: > Ok. Your test program is too large to determine what's going on. Try > to determine first *which* part is slow: Right. This is done by the diagnostic technique of writing *new*, minimal, complete programs that exercise each piece of the functionality separately. Yo

Re: Python Documentation website layout changed?

2010-03-19 Thread Steve Holden
Steve Holden wrote: > Andrej Mitrovic wrote: >> On Mar 17, 6:41 pm, Andrej Mitrovic >> wrote: >>> Hi, >>> >>> What happened to the sidebar on the left of the documentation website? >>> It seems to be gone: >>> >>> http://docs.python.org/py3k/index.html >>> >>> I found it quite useful since I can q

Re: should writing Unicode files be so slow

2010-03-19 Thread Antoine Pitrou
Le Fri, 19 Mar 2010 17:18:17 +, djc a écrit : > > changing > with open(filename, 'rU') as tabfile: to > with codecs.open(filename, 'rU', 'utf-8', 'backslashreplace') as > tabfile: > > and > with open(outfile, 'wt') as out_part: to > with codecs.open(outfile, 'w', 'utf-8') as out_part: > > ca

Tuples vs. variable-length argument lists

2010-03-19 Thread Spencer Pearson
Hi! This might be more of a personal-preference question than anything, but here goes: when is it appropriate for a function to take a list or tuple as input, and when should it allow a varying number of arguments? It seems as though the two are always interchangeable. For a simple example... def

Re: Importing v reloading modules modules

2010-03-19 Thread Gabriel Genellina
En Fri, 19 Mar 2010 14:09:09 -0300, Peter Peyman Puk escribió: I am running a simulator written in python. The simulator has a small TextView (actually a SourceView) widget which lets the user writes scripts, and when they are satisfied they can execute that script to get results. For ar

Re: Castrated traceback in sys.exc_info()

2010-03-19 Thread Gabriel Genellina
En Wed, 17 Mar 2010 09:42:06 -0300, Pascal Chambon escribió: traceback functions indeed allow the manipulation of exception tracebacks, but the root problem is that anyway, since that traceback is incomplete, your "traceback.format_exc().splitlines()" will only provide frames for callee (do

Simple lock

2010-03-19 Thread moerchendiser2k3
Hi, I have a common question about locks: class SetPointer { private: void *ptr; MY_LOCK lock; public: void SetPointer(void *p) { Lock(this->lock); this->ptr = p; } void *GetPointer() { Loc

Re: C-API PyObject_Call

2010-03-19 Thread moerchendiser2k3
Yes, the user is able to set a file which contains a function that does what the user wants. But in a case, I expect a special return value of this function. So, I need to tell him, in which file/line the error occured, otherwise he dont know where to look. Imagine he set 20 files, and all of the

Re: Simple lock

2010-03-19 Thread Ben Finney
moerchendiser2k3 writes: > I have a common question about locks: You'd be best to ask in a forum related to the language you're using. This (‘comp.lang.python’) is a forum for users of the Python language. -- \ “If you can do no good, at least do no harm.” —_Slapstick_, | `\

Re: Simple lock

2010-03-19 Thread Chris Rebert
On Fri, Mar 19, 2010 at 6:58 PM, moerchendiser2k3 wrote: > > Thanks a lot!! Bye, moerchendiser2k3 This is the **Python** mailinglist/newsgroup; and your question isn't about Python. The C++ one is over there: http://groups.google.com/group/comp.lang.c++.moderated/topics Regards, Chris -- http

Re: Simple lock

2010-03-19 Thread MRAB
moerchendiser2k3 wrote: Hi, I have a common question about locks: class SetPointer { private: void *ptr; MY_LOCK lock; public: void SetPointer(void *p) { Lock(this->lock); this->ptr = p; } void *GetPointer()

Best Way to extract Numbers from String

2010-03-19 Thread Jimbo
Hello I am trying to grab some numbers from a string containing HTML text. Can you suggest any good functions that I could use to do this? What would be the easiest way to extract the following numbers from this string... My String has this layout & I have commented what I want to grab: [CODE] ""

Re: Simple lock

2010-03-19 Thread Gabriel Genellina
En Fri, 19 Mar 2010 23:31:23 -0300, MRAB escribió: moerchendiser2k3 wrote: class SetPointer { private: void *ptr; MY_LOCK lock; public: void SetPointer(void *p) { Lock(this->lock); this->ptr = p; } 3. You're lockin

Re: Best Way to extract Numbers from String

2010-03-19 Thread Gabriel Genellina
En Sat, 20 Mar 2010 00:04:08 -0300, Jimbo escribió: I am trying to grab some numbers from a string containing HTML text. Can you suggest any good functions that I could use to do this? What would be the easiest way to extract the following numbers from this string... My String has this layout

Re: Tuples vs. variable-length argument lists

2010-03-19 Thread Steven D'Aprano
On Fri, 19 Mar 2010 17:20:31 -0700, Spencer Pearson wrote: > Hi! > > This might be more of a personal-preference question than anything, but > here goes: when is it appropriate for a function to take a list or tuple > as input, and when should it allow a varying number of arguments? That depend

Re: Simple lock

2010-03-19 Thread MRAB
Gabriel Genellina wrote: En Fri, 19 Mar 2010 23:31:23 -0300, MRAB escribió: moerchendiser2k3 wrote: class SetPointer { private: void *ptr; MY_LOCK lock; public: void SetPointer(void *p) { Lock(this->lock); this->ptr = p; } 3. You're locking, but nev

Re: Simple lock

2010-03-19 Thread Alf P. Steinbach
* MRAB: Gabriel Genellina wrote: En Fri, 19 Mar 2010 23:31:23 -0300, MRAB escribió: moerchendiser2k3 wrote: class SetPointer { private: void *ptr; MY_LOCK lock; public: void SetPointer(void *p) { Lock(this->lock); this->ptr = p; } 3. You're locking

Re: (updated) Choosing a collection of common modules/packages for a general purpose reusable PY2EXE runtime

2010-03-19 Thread Aahz
In article , wrote: > >We've decided to build a re-usable *general purpose* PY2EXE "runtime" >that can be shared by a number of scripts vs. distributing a monolithic >EXE for each of our scripts. It's not clear what the purpose of this is. You can build several scripts against the same py2exe b

Re: "EURO GIRLS" "MISS EUROPE" "MISS FRENCH" "FRENCH" "PRETTY GIRLS" "SEXY FRENCH GIRLS" on www.sexyandpretty-girls.blogspot.com "SEXY RUSSIAN GIRLS" "SEXY GREEK GIRLS" "SEXY DUTCH GIRLS" "SEXY UK G

2010-03-19 Thread Brian J Mingus
On Fri, Mar 19, 2010 at 10:18 PM, Naeem wrote: > "EURO GIRLS" "MISS EUROPE" "MISS FRENCH" "FRENCH" "PRETTY GIRLS" "SEXY > FRENCH GIRLS" on www.sexyandpretty-girls.blogspot.com "SEXY > RUSSIAN GIRLS" "SEXY GREEK GIRLS" "SEXY DUTCH GIRLS" "SEXY UK GIRLS" > "SEXY HOLLYWOOD GIRLS" "SEXY BOLLYWO

Writing tests for the Python bug tracker

2010-03-19 Thread Steven D'Aprano
I have two reported bugs in the bug tracker waiting on tests: http://bugs.python.org/issue8128 http://bugs.python.org/issue4037 Are there any guidelines for writing tests for the standard library and language? I've googled, but found nothing useful: lots of guidelines for writing tests, and of

Re: Writing tests for the Python bug tracker

2010-03-19 Thread Steven D'Aprano
On Sat, 20 Mar 2010 06:23:14 +, Steven D'Aprano wrote: > Are there any guidelines for writing tests for the standard library and > language? I've googled, but found nothing useful: lots of guidelines for > writing tests, and of course I've read PEP 8, but I'm not sure if there > are convention