Having trouble with Mock and exception side effects

2020-08-21 Thread Joshua J. Kugler
do neither when it has been replaced by a MagicMock object. Thanks for any tips, pointers, or "You're doing it wrong!" education. :) j -- Joshua J. Kugler - Fairbanks, Alaska - jos...@azariah.com Azariah Enterprises - Programming and Website Design PGP Key: http://pgp.mit.edu/ ID 0x68108cbb73b13b6a -- https://mail.python.org/mailman/listinfo/python-list

Re: compile error building building Python-3.8.5 on Debian 8.11 (yes, old!)

2020-09-04 Thread Joshua J. Kugler
t what is in that old of a version of Debian. I don't see anything that calls out the C version required in the Python docs, but I doubt they have Debian 8 in their build farm any more. j -- Joshua J. Kugler - Fairbanks, Alaska - jos...@azariah.com Azariah Enterprises - Programming and

Doing date/time + TZ math in python

2007-01-05 Thread Joshua J. Kugler
I've read docs (datetime, time, pytz, mx.DateTime), googled, and experimented. I still don't know how to accomplish what I want to accomplish. I'm loading up a bunch of date/time data that I then need to do math on to compare it to the current date/time. I can get the current time easily enough:

Re: Python plain-text database or library that supports joins?

2007-06-26 Thread Joshua J. Kugler
On Friday 22 June 2007 09:18, felciano wrote: > Hello -- > > Is there a convention, library or Pythonic idiom for performing > lightweight relational operations on flatfiles? I frequently find > myself writing code to do simple SQL-like operations between flat > files, such as appending columns f

Re: Dedicated CPU core for Python?

2007-04-26 Thread Joshua J. Kugler
On Thursday 26 April 2007 09:16, Louise Hoffman wrote: > Dear readers, > > I was wondering, if Python in the foerseeable future will allocate one > CPU core just for the interpreter, so heavy Python operations does > slow down the OS? > > It seams to me like a perfect use for a CPU core =) Are

Re: Dedicated CPU core for Python?

2007-04-27 Thread Joshua J. Kugler
On Thursday 26 April 2007 14:07, Gabriel Genellina wrote: > En Thu, 26 Apr 2007 15:54:38 -0300, Joshua J. Kugler > <[EMAIL PROTECTED]> escribió: > >> Are you talking about CPU affinity >> (http://en.wikipedia.org/wiki/Processor_affinity) or an actual CPU that >>

Re: Interop between C# and Python

2007-04-30 Thread Joshua J. Kugler
On Friday 27 April 2007 17:09, urielka wrote: > i need a easy way to write a Python Service(be it SOAP or JSONRPC or > whatever) but i need to easily access it from C#,i created a web > service in ZSI(which is really easy) like this: You might want to take a look at Thrift too: http://developers.

Re: I wish that [].append(x) returned [x]

2007-05-02 Thread Joshua J. Kugler
On Wednesday 02 May 2007 12:05, Tobiah wrote: > >> In addition to the above good advice, in case you are submitting a query >> to a DB-API compliant SQL database, you should use query parameters >> instead of building the query with string substitution. > > I tried that a long time ago, but I gu

Re: 32 OS on 64-bit machine

2007-05-03 Thread Joshua J. Kugler
On Thursday 03 May 2007 01:10, SamG wrote: > If anyone has a x86_64 machine and is running a 32bit OS on top of > that could you tell me what output would you get for the following > program > > #== > import platform > print platform.processor() > print platform.architectu

Replacement for HTMLGen?

2007-05-03 Thread Joshua J. Kugler
I realize that in today's MVC-everything world, the mere mention of generating HTML in the script is near heresy, but for now, it's what I ened to do. :) That said, can someone recommend a good replacement for HTMLGen? I've found good words about it (http://www.linuxjournal.com/article/2986), but

ANN: vuLookup.py, a TCP lookup server for Postfix

2007-05-08 Thread Joshua J. Kugler
We needed it, so we wrote it. Announcing vuLookup.py 1.0 vuLookup.py is a TCP lookup table server for Postfix, written in Python. It reads an ini file and uses the values therein to answer requests for virtual users, as well as virtual domains. You can download it here: http://www.eeinternet.c

ANN: A login wrapper for DSPAM

2007-05-08 Thread Joshua J. Kugler
I wanted it: http://www.mail-archive.com/dspam-users%40lists.nuclearelephant.com/msg00264.html So I wrote it. Annoucning DspamFrontend 1.0 DSPAM Frontend is a script written in Python designed to provide login facilities for DSPAM when HTTP basic auth is either undesireable or unavailable. dsp

Re: How to do basic CRUD apps with Python

2007-05-16 Thread Joshua J. Kugler
On Sunday 13 May 2007 15:20, walterbyrd wrote: > With PHP, libraries, apps, etc. to do basic CRUD are everywhere. Ajax > and non-Ajax solutions abound. > > With Python, finding such library, or apps. seems to be much more > difficult to find. > > I thought django might be a good way, but I can n

Re: How to do basic CRUD apps with Python

2007-05-16 Thread Joshua J. Kugler
On Monday 14 May 2007 18:46, James T. Dennis wrote: > I'm thinking of some sort of class/module that would generate > various sorts of HTML forms by default, but also allow one to > sub-class each of the form/query types to customize the contents. Turbogears has catwalk, which is already an int

Re: How to do basic CRUD apps with Python

2007-05-16 Thread Joshua J. Kugler
Sorry about the duplicate post! My news reader never showed my first reply! j -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: pyhdf

2007-05-18 Thread Joshua J. Kugler
On Wednesday 16 May 2007 09:36, [EMAIL PROTECTED] wrote: > Has anyone had success installing the pyhdf library with python 2.4 > under linux 2.6.18 (debian)? I have installed the HDF library and > development package from apt and have downloaded the pyhdf > installation files. I've had success wi

Re: model browser

2007-05-21 Thread Joshua J. Kugler
On Sunday 20 May 2007 10:55, Daniel Nogradi wrote: > Are there other options I overlooked? > > Daniel There is a CRUD template for TG: http://docs.turbogears.org/1.0/CRUDTemplate Might be what you're looking for. j -- Joshua Kugler Lead System Admin -- Senior Programmer http://www.eeinternet.

Module imports fine from interactive, not from script

2007-05-24 Thread Joshua J. Kugler
Yes, I've read this: http://mail.python.org/pipermail/python-list/2006-August/395943.html That's not my problem. I installed PlanetPlanet via the package's "setup.py install" command (as root). planet.py will not run, however, giving me this error: Traceback (most

Re: Module imports fine from interactive, not from script

2007-05-24 Thread Joshua J. Kugler
On Thursday 24 May 2007 08:32, Steve Holden wrote: > The directory containing the script you are executing is also added to > sys.path. Since you are executing a script called planet ... Ah! That's it. That had never occurred to me, as I was under the impression that your current *working* direct

Re: Reading a Directory of Emails - Problems

2007-07-24 Thread Joshua J. Kugler
On Tuesday 24 July 2007 09:38, Ryan Rosario wrote: > Hi, > > I have a directory that contains a bunch of email messages and I would > like to parse them using the email and mailbox packages. The emails were > exported from Apple Mail. From what I gather, I need to use MHMailbox, but > I can't get

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 13:28, John K Masters wrote: > On 15:34 Tue 31 Jul , Wingware wrote: >> Hi, >> >> I'm happy to announce the first beta release of Wing IDE 3.0. It is >> available from http://wingware.com/wingide/beta > If their support for paid customers is anything like their su

Bug in Time module, or in my understanding?

2007-08-01 Thread Joshua J. Kugler
I am getting results like these with the time module: >>> import time >>> int(time.mktime(time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%M %S'))) 1173610800 >>> int(time.mktime(time.strptime('2007-03-11 03:00:00', '%Y-%m-%d %H:%M %S'))) 1173610800 >>> time.strftime('%Y-%m-%d %H:%M:%S', time.lo

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 13:53, Robert Dailey wrote: > He's secretly an employee of Wing IDE in disguise!!! Sorry to destroy your conspiracy theories, but no, I've never been employed by Wing IDE in any fashion, nor have I ever received any monetary compensation from them in any form. Just a s

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 14:15, John K Masters wrote: >> > I have been trying wing for a few days but have noticed that >> > auto-completion does not work on all modules. I submitted this to wing >> > and was told that probably my PYTHONPATH was wrong. >> It may also not work if the IDE isn't su

Re: Bug in Time module, or in my understanding?

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 14:49, Jay Loden wrote: > Hope some of this helps It did, thanks! j -- Joshua Kugler Lead System Admin -- Senior Programmer http://www.eeinternet.com PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE -- http://mail.python.org/mailman/listinfo/python-list

Is shelve/dbm supposed to be this inefficient?

2007-08-01 Thread Joshua J. Kugler
I am using shelve to store some data since it is probably the best solution to my "data formats, number of columns, etc can change at any time" problem. However, I seem to be dealing with bloat. My original data is 33MB. When each row is converted to python lists, and inserted into a shelve DB,

Re: Bug in Time module, or in my understanding?

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 14:45, Paul Boddie wrote: > Well, I think that if you inspect the result of strptime, you'll see > that the last element of the time "tuple" - in fact, the tm_isdst > member of a time "structure" - is set to -1: > time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%

Re: Is shelve/dbm supposed to be this inefficient?

2007-08-01 Thread Joshua J. Kugler
On Wednesday 01 August 2007 16:08, Thomas Jollans wrote: > Have you considered a directory full of pickle files ? (In effect, > replacing the dbm with the file system) i.e. something like (untested) > > class DirShelf(dict): A very interesting idea. I'll have to see how that plays out performan

Bug in time, part 2

2007-08-02 Thread Joshua J. Kugler
Or could I entitle this, "A Wrinkle in time.py," with apologies to Madeleine L'Engle. Either I've found a bug (or rather room for improvement) in time.py, or I *really* need a time module that doesn't assume so much. After the suggestions to try setting the dst flag to zero, I did some more exper

Re: (no) fast boolean evaluation ?

2007-08-02 Thread Joshua J. Kugler
On Thursday 02 August 2007 15:19, Evan Klitzke wrote: >> I discovered that boolean evaluation in Python is done "fast" >> (as soon as the condition is ok, the rest of the expression is ignored). > > This is standard behavior in every language I've ever encountered. Then you've never programmed in

Re: Why does SocketServer default allow_reuse_address = false?

2007-03-07 Thread Joshua J. Kugler
Greg Copeland wrote: >> Is there some history to this of which I'm not aware? Is there a good >> reason for it to default to false? > Long story short, it is not a bug. It is a feature. The proper > default is that of the OS, which is to ensure SO_REUSEADDR is disabled > unless you absoluetely

Re: thread and portability Unix/Linux

2007-03-07 Thread Joshua J. Kugler
awalter1 wrote: > Hi, > I have a Python application that runs under HPUX 11.11 (then unix). It > uses threads : > from threading import Thread > # Class Main > class RunComponent(Thread): > > My application should run under Linux (red hat 3 ou 4) and I read that > differences exist between the im

Re: Why does SocketServer default allow_reuse_address = false?

2007-03-07 Thread Joshua J. Kugler
Chris Mellon wrote: >> My problem (and the reason I set reuse to True) is this: if I have >> connections active when I restart my service, upon restart, the socket >> will >> fail to bind because there is still a connection in a WAIT state. > > This is just the way sockets work on your platform. H

Re: python QT or python-GTK

2007-03-21 Thread Joshua J. Kugler
Dennis Lee Bieber wrote: > On Sun, 18 Mar 2007 11:55:47 -1000, "Jon Van DeVries" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> ** All the posts found in google are old. I'm assuming new improvements >> have been made to both IDEs. ** >> >> Please correct me if I'm wron

Finding a module's sub modules at runtime

2007-03-28 Thread Joshua J. Kugler
[If this is documented somewhere, please just point me there. I googled on the terms that made sense to me, and didn't find anything.] So, I have: ModTest __init__.py AModule.py BModule.py CModule.py All works fine. However, when I import ModTest, I would like i

Re: Finding a module's sub modules at runtime

2007-03-28 Thread Joshua J. Kugler
On Wednesday 28 March 2007 12:04, [EMAIL PROTECTED] wrote: >> All works fine. However, when I import ModTest, I would like it to >> discover and store the names of the modules beneath it, and construct a >> list, say mod_list, that I can access later to find the names of the >> sub-modules in >> t

Re: Finding a module's sub modules at runtime

2007-03-29 Thread Joshua J. Kugler
On Thursday 29 March 2007 07:33, Alex Martelli wrote: > Joshua J. Kugler <[EMAIL PROTECTED]> wrote: > >> still be nicely portable. It just seems that since Python is gathering >> that information anyway, it should make it available without me having to >> walk

Re: Object Oriented Database with interface for Pyhton

2007-03-30 Thread Joshua J. Kugler
On Friday 30 March 2007 01:04, [EMAIL PROTECTED] wrote: > Hello all > > I am looking for an object oriented database with interffaces for > python. Either open source or commercial. > > I am looking for a Database not a object persistence system. I would > like to be able to execute queries outs

Re: Finding a module's sub modules at runtime

2007-04-02 Thread Joshua J. Kugler
On Thursday 29 March 2007 17:58, Alex Martelli wrote: > Sure, pydoc (which help calls under the code) does that, with a nice mix > of inspect, os, and pkgutil.iter_modules calls. pkgutil.iter_modules > may in fact be most of what you need: > help(pkgutil.iter_modules) > Help on function iter

Re: Finding a module's sub modules at runtime

2007-04-03 Thread Joshua J. Kugler
On Monday 02 April 2007 16:33, Robert Kern wrote: >> help(pkgutil.iter_modules) >>> Help on function iter_modules in module pkgutil: >>> >>> iter_modules(path=None, prefix='') >>> Yields (module_loader, name, ispkg) for all submodules on path, >>> or, if path is None, all top-level modu

Re: SUMMON - Rapid prototyping of 2D visualizations

2007-04-05 Thread Joshua J. Kugler
On Thursday 05 April 2007 10:12, [EMAIL PROTECTED] wrote: > I have been using python for the last two years to create various > visualizations for my research in computational biology. Over the > years, I found that I often needed the same kinds of features for many > of my visualizations (OpenGL

Re: installing pyqt4 on ubuntu 6.06

2007-04-10 Thread Joshua J. Kugler
On Tuesday 10 April 2007 07:35, Pradnyesh Sawant wrote: > Any pointers regarding what packages should i install to get the > system into working condition would be very helpful It's next to impossible, due to conflicts with SIP, and other dependencies. See these two threads (both started by me)

Re: About Trolltech QT OpenSource license.

2007-04-11 Thread Joshua J. Kugler
On Tuesday 10 April 2007 12:52, Kevin Walzer wrote: > Yes. Nothing in the GPL prevents you from developing and marketing an > application for as high a price as you can get from it. > > HOWEVER: > > you will have to distribute the source code to your application to > anyone who purchases a binary

Re: Python editor/IDE on Linux?

2007-04-16 Thread Joshua J. Kugler
On Friday 13 April 2007 10:20, Jack wrote: > I wonder what everybody uses for Python editor/IDE on Linux? > I use PyScripter on Windows, which is very good. I'm using WingWare's WingIDE. Visual debugger, python-scriptable, projects, code-completion that is second-to-none (I LOVE it.). And a ve

Re: Wanted: Email Client with GUI

2007-04-18 Thread Joshua J. Kugler
On Wednesday 18 April 2007 05:07, Franz Steinhaeusler wrote: > Hi, although I have googled, I didn't find a Python > email client program fitting to my needs. > > What I want is a program (it doesn't have to be so sophisticated > as thunderbird) written totally in python and using a gui > toolkit

Re: why does Configparser change names to lowercase ?

2007-09-17 Thread Joshua J. Kugler
On Friday 14 September 2007 12:21, stef mientki wrote: > Why does Configparser change names to lowercase ? > > As Python is case sensitive (which btw I don't like at all ;-) > but now when really need the casesensitivity, > because it handles about names which should be recognized by human, > it

A struct for 2.4 that supports float's inf and nan?

2007-09-19 Thread Joshua J. Kugler
I'm trying to put some values into a struct. Some of these values are NaN and Inf due to the nature of the data. As you well may know, struct (and other things) in Python <= 2.4 doesn't support inf and nan float values. You get the dreaded "SystemError: frexp() result out of range" error. Befo

Re: A struct for 2.4 that supports float's inf and nan?

2007-09-20 Thread Joshua J. Kugler
On Thursday 20 September 2007 11:19, Paul Hankin wrote: >> I suppose I could get the relevant source from the 2.5 source and compile >> it as a custom package, but that wouldn't be very transparent for my >> users, and would probably be getting in way over my head. :) >> >> Ideas? Suggestions? >

GUI for viewing/editing python data structures?

2007-09-26 Thread Joshua J. Kugler
A while back, I seem to remember coming across a small program that could view and edit python data structures via a nice expanding tree view. I'm now in need of something like that (to verify data is imported correctly into a shelve file) and having a GUI would be much simpler than trying to wade

Re: GUI for viewing/editing python data structures?

2007-09-28 Thread Joshua J. Kugler
On Thursday 27 September 2007 22:40, David wrote: > On 9/27/07, Joshua J. Kugler <[EMAIL PROTECTED]> wrote: >> A while back, I seem to remember coming across a small program that could >> view and edit python data structures via a nice expanding tree view. I'm >&g

Re: GUI for viewing/editing python data structures?

2007-09-28 Thread Joshua J. Kugler
On Thursday 27 September 2007 20:20, Paddy wrote: > On Sep 26, 11:23 pm, "Joshua J. Kugler" <[EMAIL PROTECTED]> wrote: >> A while back, I seem to remember coming across a small program that could >> view and edit python data structures via a nice expanding tr

Re: Millisecond timestamp function?

2007-10-19 Thread Joshua J. Kugler
On Friday 19 October 2007 05:44, Dmitri O.Kondratiev wrote: > What Python module / function can be used to get millisecond timestamps? > time.time() returns the time as a floating point number expressed in > seconds since the epoch, in UTC. > > Thanks! See the module datetime. The datetime obje

Re: ConfigParser preserving file ordering

2007-10-18 Thread Joshua J. Kugler
On Thursday 18 October 2007 15:23, Frank Aune wrote: > Hello, > > I use ConfigParser and actually quite like it, EXCEPT that it doesnt > preserve the section order of the original config file when writing a new. > This behaviour is hopeless IMO, and I've been looking for alternatives. > > I've b

Re: PDF rendering toolkit?

2007-01-11 Thread Joshua J. Kugler
Jorge Vargas wrote: > On 1/6/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >> > I'm looking for a tool to take an actual .pdf file and display it in a >> > window (I'm using wxwidgets at the moment) >> >> No idea if there is a one-shot-kills-them-all solution out there - but >> if you have a way

Re: Doing date/time + TZ math in python

2007-01-11 Thread Joshua J. Kugler
[EMAIL PROTECTED] wrote: >> The problem is, how do I create a datetime object and tell it that it's >> America/Anchorage *daylight savings time* instead of whatever the system >> is >> currently set at? pytz only has America/Anchorage, and I saw no way to >> tell it explicitly that the timezone i

Re: how to mimik a main() function to start a program with entry point?

2007-01-20 Thread Joshua J. Kugler
krishnakant Mane wrote: > hello all. > I have one simple query and may be that's to stupid to answer but I am > not finding the answer any ways. > I have a set of modules in my package and out if which one is my > actual starting point to my entire program. say for example I have an > entire data

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-23 Thread Joshua J. Kugler
Daniel Jonsson wrote: > So, I've reached the point where my building pipeline tools actually > needs to be used by other people in my company. By this reason I > actually need to think about the usability, and I've come to the > conclusion that I need a GUI. So, which of the two packages should I >

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-23 Thread Joshua J. Kugler
Daniel wrote: > I've downloaded both the wxPython and the PyQt4 package, and by the > first impression I must say that the PyQt4 system had a very > compelling presentation. From what I can understand from the feedback > I've gotten so far is that the wxPython is a better choice when it > comes to

Re: Beginners Tutorial in PDF Format?

2007-01-24 Thread Joshua J. Kugler
W. Watson wrote: >>> http://docs.python.org/download.html >> >> Try again. The first url goes to this page: >> Download Python 2.5 Documentation (19 September 2006): To download an >> archive containing all the documents for this version of Python in one >> of various formats [pdf included, you c

Re: Return images with matplotlib?

2007-02-06 Thread Joshua J. Kugler
Jan Danielsson wrote: > Hello all, > >I have written a program which takes some data from a postgresql > database, and via mod_python outputs it as tables on a web site. Now I > would like to present these tables as graphs, which matplotlib can do. > But in order to properly display these g

Re: Graphs, bar charts, etc

2007-02-06 Thread Joshua J. Kugler
Jan Danielsson wrote: > Hello all, > >I have some data in a postgresql table which I view through a web > interface (the web interface is written in python -- using mod_python > under apache 2.2). Now I would like to represent this data as graphs, > bar charts, etc. > >I know about matpl

Re: Output to a text window

2007-02-16 Thread Joshua J. Kugler
[EMAIL PROTECTED] wrote: > Hi, > > I'm going around in circles so I'm asking for help. I want to read a > simple text file and output the contents to a GUI window when I click > on a button. I have written a small python program to read the > contents of a file when a button is clicked but can on

Re: Creating a daemon process in Python

2007-02-22 Thread Joshua J. Kugler
Benjamin Niemann wrote: >> What is the easiest way to create a daemon process in Python? Google >> says I should call fork() and other system calls manually, but is >> there no os.daemon() and the like? > You could try > Also, more

Why does SocketServer default allow_reuse_address = false?

2007-02-26 Thread Joshua J. Kugler
Considering that UNIX Network Programming, Vol 1 (by W. Richard Stevens) recommends "_All_ TCP servers should specify [SO_REUSEADDR] to allow the server to be restarted [if there are clients connected]," and that self.allow_reuse_address = False makes restarting a server a pain if there were connec

Re: getting terminal display size?

2007-02-26 Thread Joshua J. Kugler
jeff wrote: > I don't really understand any of that; can you right me a function > that'll return the size as a tuple? Did you even *try* his code? I ran this: import termios, fcntl, struct, sys s = struct.pack("", 0, 0, 0, 0) fd_stdout = sys.stdout.fileno() x = fcntl.ioctl(fd_stdout, ter

Re: convert many excel files to pdf in batch

2007-02-28 Thread Joshua J. Kugler
Wensui Liu wrote: > Adam, > If you could come up with a way without using Adobe writer, it should > also work for me. > thanks. > > On 28 Feb 2007 12:53:52 -0800, Adam <[EMAIL PROTECTED]> wrote: >> 1. Get PDFCreator >> 2. Install >> 3. Set as default printer >> 4. Have all excel files in same fol

Re: Python Tutorial

2007-03-01 Thread Joshua J. Kugler
Timm Florian Gloger wrote: > Hi, > > is Guido van Rossum's "Python Tutorial" in non-HTML formats (e.g. PDF > or PS) avaiable for free? > > Regards, > Timm You mean like here: http://docs.python.org/download.html You have to download them all, but a download of the PDFs will include the tutoria

ANNOUNCE: AwstatsReader 0.01

2009-08-03 Thread Joshua J. Kugler
ABOUT THE MODULE AwstatsReader is an attempt at a pythonic interface to AWStats data cache files.  Using it, you can access year, month, and individual data points via dictionary-like accessors. Download here: http://azariah.com/open_source.html ABOUT THE AUTHOR