Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:8d747a5biq4rc559tvgju088508bp0o...@4ax.com... > On Sun, 23 Nov 2014 10:21:48 +0200, "Frank Millman" > declaimed the following: > >> >> >>The default is for sqlite3 to ignore foreign key contraints. >> [...] >> >>Unfortunately it has a limitation, which

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
I am defining a single class with a destructor method that prints ‘__del__’, and running that source code string using exec with the module’s dict like so: import rtmidi import sys import types import time import gc s = """

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
Thanks for your great reply. I even augmented the reloading with the same dict by clearing all of the non-standard symbols from the dict. This effectively resets the dict: # try to clear out the module by deleting all global refs

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
Basically, I have an app and am making it possible for the users to automate it by writing python scripts that run against the app's API. It includes PyQt5 widgets, a QScintilla editor, and a simple API for I/O. Apple’s app store is the plan. Right now I create a new module with types.ModuleTyp

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
I think this is the way I’ll take it, and for all the same reasons. The only way they can break it is if they really want to. I guess anything other Franken-apps would be interesting to hear about too. And I’ll still stick it on the app store. > On Nov 23, 2014, at 1:35 AM, Chris Angelico wro

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
How does the __del__ method have a reference to the module’s globals dict? because it references the print function? Crazy. Is there any other way to comfort when a module is being deleted beside defining a class object with a printing dtor? > On Nov 23, 2014, at 4:27 PM, Ian Kelly wrote: >

Re: unloading a module created with imp.new_module

2014-11-24 Thread Chris Angelico
On Mon, Nov 24, 2014 at 6:27 PM, Patrick Stinson wrote: > How does the __del__ method have a reference to the module’s globals dict? > because it references the print function? > > Crazy. Is there any other way to comfort when a module is being deleted > beside defining a class object with a print

Re: Python Logging and printf()

2014-11-24 Thread Ganesh Pal
Hi Chris, Thanks for the comments , Iam planning to use logging handlers ( StreamHandler and FileHandler) to achieve my requirement . Any quick reference example to this will be great , Iam on Python 2.7 , Iam referring the python docs for mow. Regards, Ganesh On Fri, Nov 21, 2014 at 5:25 PM, C

A good Soap Client

2014-11-24 Thread Filadelfo Fiamma
Hi guys, My question is about Soap Client for python. Since 2011 I'm using the very good "Suds" library for consuming simple soap service. Now I need something for "SOAP over HTTPS", Does anyone know a good solution? May I use suds and write an envelope for HTTPS? Thanks in advance Bye Fil -- h

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Mark Lawrence
On 24/11/2014 06:25, Rick Johnson wrote: On Sunday, November 23, 2014 4:37:53 PM UTC-6, Gregory Ewing wrote: Chris Angelico wrote: Just out of curiosity, why does the stdlib need modules for manipulating .wav and other sound files, but we have to go to PyPI to get a PostgreSQL client? I suspe

Re: unloading a module created with imp.new_module

2014-11-24 Thread Ned Batchelder
On 11/24/14 2:25 AM, Patrick Stinson wrote: Basically, I have an app and am making it possible for the users to automate it by writing python scripts that run against the app's API. It includes PyQt5 widgets, a QScintilla editor, and a simple API for I/O. Apple’s app store is the plan. Right now

PYTHON LOGGING with StreamHandler and FileHandler

2014-11-24 Thread Ganesh Pal
Hi Team, The below program logs all the messages to the log file and displays the same on the console . Please suggest how do I ensure that error and warning log levels go ONLY to stdout and/or stder Code : import logging import sys # StreamHandler root = logging.getLogger() root.setLevel(lo

Re: unloading a module created with imp.new_module

2014-11-24 Thread Ned Batchelder
On 11/23/14 5:10 AM, Patrick Stinson wrote: I am defining a single class with a destructor method that prints ‘__del__’, and running that source code string using exec with the module’s dict like so: import rtmidi importsys import types importtime importgc s= """ class A: def __del__(self)

Re: unloading a module created with imp.new_module

2014-11-24 Thread Chris Angelico
On Mon, Nov 24, 2014 at 10:21 PM, Ned Batchelder wrote: > Keep in mind that Python object have a reference to their class. If your > users are defining classes in their modules, and you instantiate the class > to create objects, then even when you reload updated code, the old objects > will still

Re: Python Signal/Slot + QThred code analysis

2014-11-24 Thread Juan Christian
Oh, and this code I made by myself, I didn't copy. That's why I want you guys to see if everything is ok. -- https://mail.python.org/mailman/listinfo/python-list

Re: I have no class

2014-11-24 Thread Dan Sommers
On Mon, 24 Nov 2014 16:11:32 +1100, Chris Angelico wrote: > On Mon, Nov 24, 2014 at 3:21 PM, Steven D'Aprano wrote: >> On Sun, 23 Nov 2014 09:02:57 -0800, Rustom Mody wrote: >> >>> Python is a bit odd in the OO-world in that it prioritizes "Explicit is >>> better than implicit" over convenience.

Re: I have no class

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 12:44 AM, Dan Sommers wrote: > And then, at least in C++, you see coding standards that demand that > member variables (aka instance variables aka attributes) be named in > such a way that you can tell that they're member variables and not local > variables (one common conv

Re: unloading a module created with imp.new_module

2014-11-24 Thread Ian Kelly
On Nov 24, 2014 1:27 AM, "Patrick Stinson" wrote: > > How does the __del__ method have a reference to the module’s globals dict? because it references the print function? The module's dict becomes the __globals__ dict used by the function for looking up globals and builtins. > Crazy. Is there an

Re: GUI toolkit(s) status

2014-11-24 Thread Ian Kelly
On Nov 21, 2014 10:09 PM, "Michael Torrie" wrote: > I can't speak for wxWidgets, but when I last looked at it years ago it > fairly reeked of MFC-style GUI programming with event tables instead of > a nice, flexible signal/callback interface. Has this changed? I recall the C++ implementation use

Re: Basic asyncio usage

2014-11-24 Thread Benjamin Risher
On Wednesday, March 26, 2014 6:35:31 AM UTC-5, Piotr Husiatyński wrote: > Hi, > I have posted the same question to python-tutor list *, but I'm trying > my luck here as advised. > > I'm trying to get more familiar with asyncio library. Using python > 3.4, I wrote simple echo server (see attachemen

Re: unloading a module created with imp.new_module

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 2:12 AM, Ian Kelly wrote: >> Crazy. Is there any other way to comfort when a module is being deleted >> beside defining a class object with a printing dtor? > > Modules don't strictly have to be ModuleType. You could substitute a class > with a __del__ method for the module

Re: Basic asyncio usage

2014-11-24 Thread Marko Rauhamaa
Benjamin Risher : > I was wondering if you ever made progress with your asyncio project. > I'm currently digging around for examples and reference material and > came across your post. > > I'd be interested in any tips/gotchas/examples you'd be willing to > provide as far as asyncio. Here's an im

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Rick Johnson
On Monday, November 24, 2014 4:35:13 AM UTC-6, Mark Lawrence wrote: > The Native Americans are no doubt regretting their > decision to "welcome any and all immigrants". Would they > have made the same decision using Python which obviously > wouldn't have been available at that time? FINDERS KEEPE

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Ned Batchelder
On 11/24/14 11:51 AM, Rick Johnson wrote: ... lots of off-topic ranting ... Everyone: as tempting as it is to respond, the best course of action will be to completely ignore Rick's rants. Thanks, -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Robin Becker
On 24/11/2014 16:51, Rick Johnson wrote: EVOLUTION LOVES A WINNER! I think evolution actually requires losers. Clearly there are more extinct species, peoples, languages etc etc than there are existing ones so perhaps if evolution 'loves' anything it 'loves' a loser. -- Robin Becker -- http

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Marko Rauhamaa
Rick Johnson : > FINDERS KEEPERS; LOSERS WEEPERS! > > Contrary to your naive interpretation of history, the native > Americans [...] Was this rant at least produced by a Python generator? Where's the StopIteration exception when you need one? Marko -- https://mail.python.org/mailman/listinfo/

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Rustom Mody
On Monday, November 24, 2014 10:38:52 PM UTC+5:30, Marko Rauhamaa wrote: > Rick Johnson : > > > FINDERS KEEPERS; LOSERS WEEPERS! > > > > Contrary to your naive interpretation of history, the native > > Americans [...] > > Was this rant at least produced by a Python generator? > > Where's the Sto

Re: Help with Python Multiprocessing

2014-11-24 Thread sohcahtoa82
On Sunday, November 23, 2014 12:56:51 PM UTC-8, Anurag wrote: > Hey Socha, > Your solution works. But then, all my 3 workers are running in a single > command window. How do I make them run in three different command windows? That, I don't know. You would probably need to open a new command wind

Re: Comprehension with two variables - explanation needed

2014-11-24 Thread Steven D'Aprano
Chris Angelico wrote: > On Mon, Nov 24, 2014 at 3:42 PM, Steven D'Aprano > wrote: >> Today dis() returns the above, tomorrow it may return: >> >> 0 LOAD_GLOBAL 0 (x) >> 3 INCREMENT >> 5 RETURN_VALUE >> >> (say), and the Python code remains th

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Ian Kelly
On Nov 23, 2014 4:41 PM, "Gregory Ewing" wrote: > > Chris Angelico wrote: >> >> Just out of curiosity, why does the stdlib need modules for >> manipulating .wav and other sound files, but we have to go to PyPI to >> get a PostgreSQL client? > > > I suspect it's mainly for historical reasons. The w

Re: python 2.7 and unicode (one more time)

2014-11-24 Thread Steven D'Aprano
Marko Rauhamaa wrote: >> Py3's byte strings are still strings, though. > > Hm. I don't think so. In a plain English sense, maybe, but that kind of > usage can lead to confusion. Only if you are determined to confuse yourself. People are quite capable of interpreting correctly sentences like: "

Re: python 2.7 and unicode (one more time)

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 9:56 AM, Steven D'Aprano wrote: > In all cases apart from an explicit "byte string", the word "string" is > always used for the native array-of-characters type delimited by plain > quotation marks, as used for error messages, user prompts, etc., regardless > whether the imp

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 5:44 AM, Dennis Lee Bieber wrote: > On Mon, 24 Nov 2014 10:05:11 +0200, "Frank Millman" > declaimed the following: > >>I will explain why such a feature would have been useful for me. >> >>My accounting system handles multiple companies. I needed to figure out a >>way to k

Loading Python 2.7

2014-11-24 Thread Seymore4Head
When I installed Python, I installed 2.7 and 3.4. I am using XP. I have been using Python 3 by just right clicking on a py file and choose Edit with Idle. That works just fine when I am using 3, but since I also use 2.7 for practice from online courses I haven't figured out how to use the interac

Re: Comprehension with two variables - explanation needed

2014-11-24 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 8:42 PM, Steven D'Aprano wrote: > On Sun, 23 Nov 2014 08:45:39 -0800, Rustom Mody wrote: >> First a one-line solution in haskell >> >> sieve (p:xs) =p:sieve [x | x <- xs, x `mod` p /= 0] > > Don't use that! That is a horribly inefficient way to generate primes. > > Ma

Re: A good Soap Client

2014-11-24 Thread Cameron Simpson
On 24Nov2014 10:46, Filadelfo Fiamma wrote: My question is about Soap Client for python. Since 2011 I'm using the very good "Suds" library for consuming simple soap service. Now I need something for "SOAP over HTTPS", Does anyone know a good solution? May I use suds and write an envelope for HTT

Re: Loading Python 2.7

2014-11-24 Thread Wiktor
On Mon, 24 Nov 2014 18:25:25 -0500, Seymore4Head wrote: > What I do when I need to run 2.7 code is to just save the file to my > Python 2.7 folder and run a command prompt. I then just type the py > file. That works but I am left with a dos prompt when the file > finishes. I sometimes would lik

Re: Python Signal/Slot + QThred code analysis

2014-11-24 Thread Michael Torrie
On 11/24/2014 06:25 AM, Juan Christian wrote: > Oh, and this code I made by myself, I didn't copy. That's why I want you > guys to see if everything is ok. Looks alright. Does it work? -- https://mail.python.org/mailman/listinfo/python-list

Ducktyping

2014-11-24 Thread Steven D'Aprano
https://pbs.twimg.com/media/B3Fvg-sCYAAkLSV.jpg -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:lrr67al6ppa852agu9rq2dstqtue17i...@4ax.com... > On Mon, 24 Nov 2014 10:05:11 +0200, "Frank Millman" > declaimed the following: > >> >>Originally I supported two databases - PostgreSQL and Sql Server. They >>both >>have a concept called 'schemas', which

Re: python 2.7 and unicode (one more time)

2014-11-24 Thread Marko Rauhamaa
Steven D'Aprano : > Marko Rauhamaa wrote: > >>> Py3's byte strings are still strings, though. >> >> Hm. I don't think so. In a plain English sense, maybe, but that kind of >> usage can lead to confusion. > > Only if you are determined to confuse yourself. > > {...] > > In Python usage, "string" a

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 4:31 PM, Frank Millman wrote: > > "Dennis Lee Bieber" wrote in message > news:lrr67al6ppa852agu9rq2dstqtue17i...@4ax.com... >> We must have a different impression of what a "schema" consists of. As >> I learned it, the "schema" basically came down to the statements definin

Re: A good Soap Client

2014-11-24 Thread dieter
Filadelfo Fiamma writes: > Since 2011 I'm using the very good "Suds" library for consuming simple soap > service. > Now I need something for "SOAP over HTTPS", Does anyone know a good > solution? May I use suds and write an envelope for HTTPS? I can enforce Camerons statement: "suds" simply uses

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
> On Nov 24, 2014, at 6:12 AM, Ian Kelly wrote: > > > On Nov 24, 2014 1:27 AM, "Patrick Stinson" > wrote: > > > > How does the __del__ method have a reference to the module’s globals dict? > > because it references the print function? > > The module's dict becom

Re: PYTHON LOGGING with StreamHandler and FileHandler

2014-11-24 Thread dieter
Ganesh Pal writes: > The below program logs all the messages to the log file and displays the > same on the console . > > Please suggest how do I ensure that error and warning log levels go ONLY to > stdout and/or stder You read the handler related documentation of the logging module. When I rem

Re: Ducktyping

2014-11-24 Thread Rustom Mody
On Tuesday, November 25, 2014 10:08:28 AM UTC+5:30, Steven D'Aprano wrote: > https://pbs.twimg.com/media/B3Fvg-sCYAAkLSV.jpg :-) I will use this in a class. Now to hunt a cartoon for the opposite -- static/rigorous typing -- https://mail.python.org/mailman/listinfo/python-list

Re: unloading a module created with imp.new_module

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 5:48 PM, Patrick Stinson wrote: > Is it still possible to import non-module objects? I guess this question is > just for fun now :) rosuav@sikorsky:~$ python3 Python 3.5.0a0 (default:23ab1197df0b, Nov 20 2014, 12:57:44) [GCC 4.7.2] on linux Type "help", "copyright", "credi

Re: unloading a module created with imp.new_module

2014-11-24 Thread Patrick Stinson
> On Nov 24, 2014, at 2:44 AM, Ned Batchelder wrote: > > On 11/23/14 5:10 AM, Patrick Stinson wrote: >> I am defining a single class with a destructor method that prints >> ‘__del__’, and running that source code string using exec with the >> module’s dict like so: >> >> import rtmidi >> import

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
> On Nov 23, 2014, at 4:57 AM, Chris Angelico wrote: > > On Mon, Nov 24, 2014 at 12:20 AM, Patrick Stinson > wrote: >> I think this is the way I’ll take it, and for all the same reasons. The only >> way they can break it is if they really want to. I guess anything other >> Franken-apps would

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 6:38 PM, Patrick Stinson wrote: > Thanks for the stories in this and the other thread. I love these interesting > problems that push the limits :) I agree. How boring is life when we never push the limits! ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: A good Soap Client

2014-11-24 Thread Filadelfo Fiamma
Thanks Cameron,Dieter! Sure I haven't understood how to pass and use the certificate to the client. I thought to write a HTTPS client to extract the clean SOAP envelope and then passing it to Suds. Just for info, the service I need to consume It's the Italian Healthcare System for Medical Doctor. C