Re: Matplotlib Contour Plots

2014-08-20 Thread Jamie Mitchell
On Tuesday, August 19, 2014 10:21:48 PM UTC+1, pec...@pascolo.net wrote: > Jamie Mitchell writes: > > > > > You were right Christian I wanted a shape (2,150). > > > > > > Thank you Rustom and Steven your suggestion has worked. > > > > >

Re: Matplotlib Contour Plots

2014-08-19 Thread Jamie Mitchell
You were right Christian I wanted a shape (2,150). Thank you Rustom and Steven your suggestion has worked. Unfortunately the data doesn't plot as I imagined. What I would like is: X-axis - hs_con_sw Y-axis - te_con_sw Z-axis - Frequency What I would like is for the Z-axis to contour the freque

Re: Matplotlib Contour Plots

2014-08-18 Thread Jamie Mitchell
I forgot to mention that when I try: a=np.array([[hs_con_sw],[te_con_sw]]) I get a 3D shape for some reason - (2,1,150) which is not what I'm after. Thanks, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib Contour Plots

2014-08-18 Thread Jamie Mitchell
On Friday, August 15, 2014 4:13:26 PM UTC+1, Steven D'Aprano wrote: > Jamie Mitchell wrote: > > > > > I created the 2D array which read as: > > > > That's not a 2D array. > > > > When the amount of data you have is too big to clearly s

Re: Matplotlib Contour Plots

2014-08-15 Thread Jamie Mitchell
On Friday, August 15, 2014 2:23:25 PM UTC+1, Steven D'Aprano wrote: > Jamie Mitchell wrote: > > > > [...] > > > I just want to get a contour plot of two numpy arrays. > > > When I call plt.contour on my data I get "input must be a 2D array" >

Re: Matplotlib Contour Plots

2014-08-15 Thread Jamie Mitchell
On Thursday, August 14, 2014 5:53:09 PM UTC+1, Steven D'Aprano wrote: > Jamie Mitchell wrote: > > > > > Hello all, > > > > > > I want to contour a scatter plot but I don't know how. > > > > > > Can any

Matplotlib Contour Plots

2014-08-14 Thread Jamie Mitchell
Hello all, I want to contour a scatter plot but I don't know how. Can anyone help me out? Cheers, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Contouring a 2D histogram

2014-06-27 Thread Jamie Mitchell
Hi all, I have plotted a 2D histogram like so: python2.7 import netCDF4 import iris import iris.palette import numpy as np import matplotlib as mpl import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt from matplotlib.colors import from_levels_and_colors fig=p

Re: Matplotlib Colouring outline of histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 9:10:58 AM UTC+1, Jamie Mitchell wrote: > Hi folks, > > > > Instead of colouring the entire bar of a histogram i.e. filling it, I would > like to colour just the outline of the histogram. Does anyone know how to do > this? > > Version -

Re: Matplotlib Colouring outline of histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 2:47:03 PM UTC+1, Jason Swails wrote: > On Fri, Jun 20, 2014 at 4:10 AM, Jamie Mitchell wrote: > > Hi folks, > > > > Instead of colouring the entire bar of a histogram i.e. filling it, I would > like to colour just the outline of the histogr

Re: Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 9:46:29 AM UTC+1, Jamie Mitchell wrote: > Hi folks, > > > > I'm trying to plot a 2D histogram but I'm having some issues: > > from pylab import * > > import numpy as np > > import netCDF4 > > hist,xedges,yedges=

Re: Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 12:00:15 PM UTC+1, Peter Otten wrote: > Jamie Mitchell wrote: > > > > > I have changed my x and y data to float64 types but I am still getting the > > > same error message? > > > > Please double-check by adding > >

Re: Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
On Friday, June 20, 2014 10:25:44 AM UTC+1, Peter Otten wrote: > Jamie Mitchell wrote: > > > > > Hi folks, > > > > > > I'm trying to plot a 2D histogram but I'm having some issues: > > > from pylab import * > > > im

Problem with numpy 2D Histogram

2014-06-20 Thread Jamie Mitchell
Hi folks, I'm trying to plot a 2D histogram but I'm having some issues: from pylab import * import numpy as np import netCDF4 hist,xedges,yedges=np.histogram2d(x,y,bins=10) extent=[xedges[0],xedges[-1],yedges[0],yedges[-1]] imshow(hist.T,extent=extent,interpolation='nearest') colorbar() show() Af

Matplotlib Colouring outline of histogram

2014-06-20 Thread Jamie Mitchell
Hi folks, Instead of colouring the entire bar of a histogram i.e. filling it, I would like to colour just the outline of the histogram. Does anyone know how to do this? Version - Python2.7 Cheers, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Overlaying a boxplot onto a time series figure

2014-06-06 Thread Jamie Mitchell
Hi there, I would like to overlay some boxplots onto a time series. I have tried pylab.hold(True) in between the two plots in my code but this hasn't worked. The problem is that the x-axes of the boxplots and the time series are not the same. Code for time series: python2.7 import netCDF4 im

Re: Matplotlib - specifying bin widths

2014-06-06 Thread Jamie Mitchell
On Thursday, June 5, 2014 4:54:16 PM UTC+1, Jamie Mitchell wrote: > Hello all! > > > > Instead of setting the number of bins I want to set the bin width. > > > > I would like my bins to go from 1.7 to 2.4 in steps of 0.05. > > > > How do I

Re: Adding R squared value to scatter plot

2014-06-05 Thread Jamie Mitchell
On Wednesday, May 21, 2014 1:30:16 PM UTC+1, Jason Swails wrote: > > > > > > > On Wed, May 21, 2014 at 7:59 AM, Jamie Mitchell wrote: > > I have made a plot using the following code: > > > > python2.7 > > import netCDF4 > > impo

Matplotlib - specifying bin widths

2014-06-05 Thread Jamie Mitchell
Hello all! Instead of setting the number of bins I want to set the bin width. I would like my bins to go from 1.7 to 2.4 in steps of 0.05. How do I say this in the code? Cheers, Jamie -- https://mail.python.org/mailman/listinfo/python-list

Adding R squared value to scatter plot

2014-05-21 Thread Jamie Mitchell
I have made a plot using the following code: python2.7 import netCDF4 import matplotlib.pyplot as plt import numpy as np swh_Q0_con_sw=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swest_annavg1D.nc','r') hs_Q0_con_sw=swh_Q0_con_sw.variables['hs'][:] swh_Q3_con_sw

Saving a file as netCDF4 in Python

2014-05-08 Thread Jamie Mitchell
Dear all, Apologies as this sounds like a very simple question but I can't find an answer anywhere. I have loaded a netCDF4 file into python as follows: swh=netCDF4.Dataset('path/to/netCDFfile,'r') I then isolate the variables I wish to plot: hs=swh.variables['hs'] year=swh.variables['year']

Re: len() of unsized object - ks test

2014-04-25 Thread Jamie Mitchell
On Friday, April 25, 2014 3:07:54 PM UTC+1, Jamie Mitchell wrote: > Hello all, > > > > I am trying to perform a Kolmogorov-Smirnov test in Python but I'm having a > few difficulties. > > > > # My files are netCDF so I import them as follows: > >

len() of unsized object - ks test

2014-04-25 Thread Jamie Mitchell
Hello all, I am trying to perform a Kolmogorov-Smirnov test in Python but I'm having a few difficulties. # My files are netCDF so I import them as follows: control=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swest_concatannavg_1D.nc','r') # The string is simp

Line of best fit

2014-03-31 Thread Jamie Mitchell
I am new to python so apologies for the ignorance with this question. How would I apply a line of best fit to a plot? My data are netCDF4 data files and this is essentially what I have done so far: swh1=netCDF4.Dataset('filename','r') hs1=swh1.variables['hs'] swh2=netCDF4.Dataset('filename'.'r'

Re: Memory error

2014-03-24 Thread Jamie Mitchell
On Monday, March 24, 2014 11:32:31 AM UTC, Jamie Mitchell wrote: > Hello all, > > > > I'm afraid I am new to all this so bear with me... > > > > I am looking to find the statistical significance between two large netCDF > data sets. > > > >

Memory error

2014-03-24 Thread Jamie Mitchell
Hello all, I'm afraid I am new to all this so bear with me... I am looking to find the statistical significance between two large netCDF data sets. Firstly I've loaded the two files into python: swh=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/averages/swh_control_concat.nc', 'r')

Re: odt2sphinx 0.2.3 released

2012-09-12 Thread Dustin J. Mitchell
On Wed, Sep 12, 2012 at 10:06 AM, wrote: > ߒߤߒߡߜߦߡ ß ß§ And that's why you shouldn't let your kids play with your iPad :) Dustin -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard Asynchronous Python

2012-09-11 Thread Dustin J. Mitchell
Thanks for the second round of responses. I think this gives me some focus - concentrate on the API, talk to the framework developers, and start redrafting the PEP sooner rather than later. Thanks! Dustin -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard Asynchronous Python

2012-09-10 Thread Dustin J. Mitchell
The responses have certainly highlighted some errors in emphasis in my approach. * My idea is to propose a design PEP. (Steven, Dennis) I'm not at *all* suggesting including uthreads in the standard library. It's a toy implementation I used to develop my ideas. I think of this as a much smaller

Standard Asynchronous Python

2012-09-09 Thread Dustin J. Mitchell
After seeing David Mertz's talk at PyCon 2012, "Coroutines, event loops, and the history of Python generators" [1], I got thinking again about Python's expressive power for asynchronous programming. Generators, particularly with the addition of 'yield from' and 'return' in PEP 380 [2], allow us to

Import on case insensitive filesystem

2011-05-13 Thread Mitchell Hashimoto
tempts to import the same file (itself) instead of finding the Crypto module since the filesystem casing is incorrect. Any tips would be greatly appreciated. Best, Mitchell -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdout vs. sys.stderr

2010-03-09 Thread Mitchell L Model
On Jan 11, 2010, at 1:47 PM Nobody wrote: On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote: In Python 3.1 is there any difference in the buffering behavior of the initial sys.stdout and sys.stderr streams? No. Were they different at some earlier point in Python's evolution?

CGI, POST, and file uploads

2010-03-03 Thread Mitchell L Model
On Mar 2, 2010, at 4:48 PM, I wrote: Can someone tell me how to upload the contents of a (relatively small) file using an HTML form and CGI in Python 3.1? As far as I can tell from a half-day of experimenting, browsing, and searching the Python issue tracker, this is broken. followed by

CGI, POST, and file uploads

2010-03-02 Thread Mitchell L Model
Can someone tell me how to upload the contents of a (relatively small) file using an HTML form and CGI in Python 3.1? As far as I can tell from a half-day of experimenting, browsing, and searching the Python issue tracker, this is broken. Very simple example: http://localhost

RE: Call Signtool using python

2010-03-02 Thread Matt Mitchell
I think you need to use the /p switch to pass signtool.exe a password when using the /f switch. Check out http://msdn.microsoft.com/en-us/library/8s9b9yaz%28VS.80%29.aspx for more info. --- The information contained in this electronic message and any attached d

Is there a better way to do this?

2010-03-01 Thread Matt Mitchell
Hi, I wrote a python script that uses pysvn to export projects from an svn repo I have. The repo has hundreds of projects in it with a directory structure that is pretty uniform however it's not exactly uniform because of the capitalization. I.e.: \root \project English \Stuff \Stu

lists as an efficient implementation of large two-dimensional arrays(!)

2010-02-02 Thread Mitchell L Model
An instructive lesson in YAGNI ("you aren't going to need it"), premature optimization, and not making assumptions about Python data structure implementations. I need a 1000 x 1000 two-dimensional array of objects. (Since they are instances of application classes it appears that the array m

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
On Jan 28, 2010, at 1:40 PM, Terry Reedy wrote ... On 1/28/2010 11:03 AM, Mitchell L Model wrote: I have been working with Python 3 for over a year. ... I agree completely. Such sweet words to read! Conversion of old code is greatly facilitied by the 2to3 tool that comes with

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
On Jan 28, 2010, at 12:00 PM, python-list-requ...@python.org wrote: From: Roy Smith Date: January 28, 2010 11:09:58 AM EST To: python-list@python.org Subject: Re: python 3's adoption In article , Mitchell L Model wrote: I use the sep and end keywords all the time. What are 

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
I have been working with Python 3 for over a year. I used it in writing my book "Bioinformatics Programming Using Python" (http://oreilly.com/catalog/9780596154509 ). I didn't see any point in teaching an incompatible earlier version of a language in transition. In preparing the book and its e

Re: I really need webbrowser.open('file://') to open a web browser

2010-01-27 Thread Mitchell L Model
On Jan 27, 2010, at 3:31 PM, Timur Tabi wrote: On Wed, Jan 27, 2010 at 12:29 PM, Mitchell L Model wrote: I had some discussions with the Python documentation writers that led to the following note being included in the Python 3.1 library documentation for webbrowser.open: "Note th

Re: I really need webbrowser.open('file://') to open a web browser

2010-01-27 Thread Mitchell L Model
On Jan 15, 2010, at 3:59 PM, Timur Tabi After reading several web pages and mailing list threads, I've learned that the webbrowser module does not really support opening local files, even if I use a file:// URL designator. In most cases, webbrowser.open() will indeed open the default web brow

sys.stdout vs. sys.stderr

2010-01-10 Thread Mitchell L Model
In Python 3.1 is there any difference in the buffering behavior of the initial sys.stdout and sys.stderr streams? They are both line_buffered and stdout doesn't seem to use a larger-grain buffering, so they seem to be identical with respect to buffering. Were they different at some earlier

Re: Python-list Digest, Vol 76, Issue 97

2010-01-09 Thread Mitchell L Model
On Jan 8, 2010, at 7:35:39 PM EST, Terry Reedy wrote: On 1/8/2010 12:02 PM, Mitchell L Model wrote: On further reflection, I will add that what appears to be happening is that during import both the global and local dictionaries are set to a copy of the globals() from the importing

Re: One function calling another defined in the same file being exec'd

2010-01-08 Thread Mitchell L Model
On Jan 8, 2010, at 9:55 AM, "Gabriel Genellina" p...@yahoo.com.ar> wrote: Ok - short answer or long answer? Short answer: Emulate how modules work. Make globals() same as locals(). (BTW, are you sure you want the file to run with the *same* globals as the caller? It sees the dofile() fun

Re: One function calling another defined in the same file being exec'd

2010-01-08 Thread Mitchell L Model
On Jan 7, 2010, at 10:45 PM, Steven D'Aprano > wrote an extensive answer to my questions about one function calling another in the same file being exec'd. His suggestion about printing out locals() and globals() in the various possible places provided the clues to explain what was going on.

Re: One function calling another defined in the same file being exec'd

2010-01-07 Thread Mitchell L Model
I forgot to offer one answer for question [3] in what I just posted: I can define all the secondary functions inside one main one and just call the main one. That provides a separate local scope within the main function, with the secondary functions defined inside it when (each time) the ma

One function calling another defined in the same file being exec'd

2010-01-07 Thread Mitchell L Model
[Python 3.1] I thought I thoroughly understood eval, exec, globals, and locals, but I encountered something bewildering today. I have some short files I want to exec. (Users of my application write them, and the application gives them a command that opens a file dialog box and execs the chose

RE: Gray Hat Python: Python Programming for Hackers Soft copy

2009-11-20 Thread Matt Mitchell
You mean like: http://nostarch.com/ghpython.htm From: python-list-bounces+mmitchell=transparent@python.org [mailto:python-list-bounces+mmitchell=transparent@python.org] On Behalf Of Elf Scripter Sent: Friday, November 20, 2009 3:31 PM To: python-list@python.org Subject: Gray Hat Python

RE: XML root node attributes

2009-11-17 Thread Matt Mitchell
--- The information contained in this electronic message and any attached document(s) is intended only for the personal and confidential use of the designated recipients named above. This message may be confidential. If the reader of this message is not the i

RE: tkFileDialog question

2009-11-16 Thread Matt Mitchell
--- The information contained in this electronic message and any attached document(s) is intended only for the personal and confidential use of the designated recipients named above. This message may be confidential. If the reader of this message is not the i

RE: tkFileDialog question

2009-11-13 Thread Matt Mitchell
-6300 or by electronic mail immediately. Thank you. -Original Message- From: python-list-bounces+mmitchell=transparent@python.org [mailto:python-list-bounces+mmitchell=transparent@python.org] On Behalf Of Matt Mitchell Sent: Friday, November 13, 2009 9:33 AM To: python-list

tkFileDialog question

2009-11-13 Thread Matt Mitchell
Hi, This is my first attempt to write a script with any kind of gui. All I need the script to do is ask the user for a directory and then do stuff with the files in that directory. I used tkFileDialog.askdirectory(). It works great but it pops up an empty tk window. Is there any way to prevent

Using pySNMP

2009-09-28 Thread Raful CIV Mitchell H
I realize this is not the pySNMP mailing list. However, can someone tell me if pySNMP uses human readable forms of mibs, such as Net-SNMP does, or does it use only the oid's? Thanks Mitch -- http://mail.python.org/mailman/listinfo/python-list

From Perl to Python

2009-09-10 Thread Raful CIV Mitchell H
General newbie type question...open ended. I have been scripting in Perl for 8 years for net management purposes. Mostly interacting with SNMP and Cisco MIBS in general. I would like to re-write these scripts in Python. Any suggestions in how to get started in Python and , especially, needin

From Perl to Python

2009-09-10 Thread Raful CIV Mitchell H
General newbie type question...open ended. I have been scripting in Perl for 8 years for net management purposes. Mostly interacting with SNMP and Cisco MIBS in general. I would like to re-write these scripts in Python. Any suggestions in how to get started in Python and , especially, needin

Re: invoking a method from two superclasses

2009-07-01 Thread Mitchell L Model
[Continuing the discussion about super() and __init__] The documentation of super points out that good design of diamond patterns require the methods to have the same signature throughout the diamond. That's fine for non-mixin classes where the diamond captures different ways of handling the sa

Re: invoking a method from two superclasses

2009-06-30 Thread Mitchell L Model
>From: Scott David Daniels >Date: Tue, 30 Jun 2009 16:49:18 -0700 >Message-ID: >Subject: Re: invoking a method from two superclasses > >Mitchell L Model wrote: >>In Python 3, how should super() be used to invoke a method defined in C > > that overrides its two super

Re: invoking a method from two superclasses

2009-06-30 Thread Mitchell L Model
Allow me to add to my previous question that certainly the superclass methods can be called explicitly without resorting to super(), e.g.: class C(A, B): def __init__(self): A.__init__(self) B.__init__(self) My question is really whether there is any way of get

invoking a method from two superclasses

2009-06-30 Thread Mitchell L Model
In Python 3, how should super() be used to invoke a method defined in C that overrides its two superclasses A and B, in particular __init__? class A: def __init__(self): print('A') class B: def __init__(self): print('B') class C(A, B):

sqlite3, qmarks, and NULL values

2009-05-19 Thread Mitchell L Model
Suppose I have a simple query in sqlite3 in a function: def lookupxy(x, y): conn.execute("SELECT * FROM table WHERE COL1 = ? AND COL2 = ?", (x, y)) However, COL2 might be NULL. I can't figure out a value for y that would retrieve rows for which COL2 is NULL. It s

Re: python scalability

2008-07-10 Thread Tim Mitchell
Thanks for all the replies - they have all been helpful. On reflection I think our problems are probably design and people related. Cheers, Tim Michele Simionato wrote: On Jul 10, 6:32 am, Tim Mitchell <[EMAIL PROTECTED]> wrote: Hi All, I work on a desktop application that ha

python scalability

2008-07-09 Thread Tim Mitchell
Hi All, I work on a desktop application that has been developed using python and GTK (see www.leapfrog3d.com). We have around 150k lines of python code (and 200k+ lines of C). We also have a new project manager with a C# background who has deep concerns about the scalability of python as our

how do I know if I'm using a debug build of python

2008-04-17 Thread Tim Mitchell
Hi, A quick question: Is there any way for a python script to know if it's being executed by a debug build of python (python_d.exe) instead of python? Thanks Tim -- http://mail.python.org/mailman/listinfo/python-list

Redux: Allowing 'return obj' in generators

2007-06-10 Thread Dustin J. Mitchell
This question was first brought up in October of 2005[1], and was included in the "Unresolved Issues" section of my microthreading PEP, which I have quietly withdrawn from consideration due to lack of community interest. PEP 255 says Q. Then why not allow an expression on "return" too? A

Re: Video: Professor of Physics Phd at Cal Tech says: 911 Inside Job

2007-04-29 Thread Mitchell Jones
purposes only, and is not to be taken as an indication that I am interesting in slogging my way through all this stuff again. Once is more than enough, and so I am killfiling this thread after making this post. --Mitchell Jones}*** **

Re: Calling functions

2006-10-19 Thread Dustin J. Mitchell
Tommy Grav wrote: > I have a small program that goes something like this > > def funcA() : pass > def funcB() : pass > def funcC() : pass > > def determine(f): > t = f() > return t > > What I would like to do is be able to > > n = determine(funcA) > m = determine(funcB) > > But I can't really

httplib problems -- bug, or am I missing something?

2006-10-19 Thread Dustin J. Mitchell
I'm building an interface to Amazon's S3, using httplib. It uses a single object for multiple transactions. What's happening is this: HTTP > PUT /unitest-temp-1161039691 HTTP/1.1 HTTP > Date: Mon, 16 Oct 2006 23:01:32 GMT HTTP > Authorization: AWS <>:KiTWRuq/6aay0bI2J5DkE2TAWD0= HTTP > (end head

Re: Dictionaries again - where do I make a mistake?

2006-10-19 Thread Dustin J. Mitchell
Lad wrote: > Sorting seems to be OK,. > the command > print key,val > prints the proper values > but I can not create Newdict to be sorted properly. > > Where do I make a mistake? > Thank you for help. Dictionaries are unordered -- the order in which items come out is unspecified. It's based on

Re: AttributeError: 'Attributes' object has no attribute 'saveFile'

2006-08-31 Thread t . mitchell
Hi Sounds like you've got a wizard-type interface thing happening. I haven't used wxGlade but I have done similar things in GTK several times. Try putting all the windows in a notebook widget with hidden tabs. Put the 'Next Page' button and the filename outside the notebook. This makes the filen

Re: Trouble finding references that are keeping objects alive

2006-08-31 Thread t . mitchell
More info: The project has cyclic references to the objects in the projects, but this should be handled by gc.collect(). Here's is my 'project still alive' test: # store a weakref for debugging p = weakref.ref(self.data.project) self.data.setProject(None, None)

Trouble finding references that are keeping objects alive

2006-08-31 Thread t . mitchell
Hi, I have a python gtk app that allows users to have one project open at a time. I have recently discovered that projects are not being freed when they are closed - the refcount is not hitting zero. I have used gc.get_referrers() to track down a few culprits, but I have now found that some of m

Re: Python book for a non-programmer

2005-11-25 Thread shane . mitchell
http://www.python.org/doc/Intros.html and two great texts when she has covered the basics are: http://diveintopython.org/ http://www.mindview.net/Books/TIPython -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't instantiate class

2005-11-06 Thread David Mitchell
: cannot import name DataUtil Could these errors have something to do with the fact that I am doing this through mod_python? Thanks again, Dave Michael P. Soulier wrote: > On 11/6/05, David Mitchell <[EMAIL PROTECTED]> wrote: > >>import DataUtil >> >> File &q

Can't instantiate class

2005-11-06 Thread David Mitchell
Hello, Here is a very basic question, but it is frustrating me to no end nonetheless. I have one file called addLink.py. In a method in this file I am trying to instantiate a class and call a method from that class. Here is the code: def getCategories(): # instantiate the DataUtil clas

Where to save classes? How to access classes?

2005-10-31 Thread David Mitchell
Hi, I'm trying to get into the object oriented aspect of Python. If I create a custom class (in it's own file), how do I access that class in a function in a different file? In Java there's the notion of a CLASSPATH, where you can tell the compiler to look for classes. Is there something simil

Problem With Insert with MySQLdb

2005-10-30 Thread David Mitchell
Hello, I am a complete beginner with Python. I've managed to get mod_python up and running with Apache2 and I'm trying to a simple insert into a table in a MySQL database. I'm using the MySQLdb library for connectivity. I can read from the database no problem, but when I do an insert, the value

Store doctest verbose results to a variable

2005-05-26 Thread mitchell
Is it possible to store doctest's verbose output to a variable? For example: import doctest, my_test_module a = doctest.testmod(my_test_module) The contents of 'a' is the tuple of passed and failed results. I tried passing verbose mode to the testmod function, but 'a' is still a tuple. Any

Dynamic doctests?

2005-05-13 Thread mitchell
I'm trying to execute doc tests without writing to the filesystem (i.e. in the Python interpreter). I have something like: """ Docstring: >>> n 6 """ # Code: n=6 import doctest doctest.testmod() The tests all pass when saving this text to a python script (as it should), but wh