[Tutor] help with a class

2011-08-24 Thread John
, but I'm not sure about the override_options method... and for that matter, I'm not sure this is the best approach overall... any comments, critiques? Thank you, john class Runner(object): Initiate with an optional dictionary of settings. Defaults are set in the options dictionary, which

Re: [Tutor] help with a class

2011-08-24 Thread John
Thank you. I've corrected the KeyError, and changed the function to: def overide_options(self, options, run_id=None): completely overide the options dict assert isinstance(options, dict), override options requires a dict if run_id in self.run_queue:

[Tutor] understanding **kwargs syntax

2011-08-25 Thread John
}.format(kw, kwargs[kw])) Are there some good examples of when this would be a good idea to implement? --john ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help with a class

2011-08-25 Thread John
Thanks for the feedback. I wasn't aware about the assert usage not being intended for production code. On Wed, Aug 24, 2011 at 11:37 PM, Alan Gauld alan.ga...@btinternet.com wrote: On 24/08/11 21:03, Prasad, Ramit wrote: I was under the impression that asserts are more for testing than for

[Tutor] help with 'organization'

2011-08-25 Thread John
Hello, I am writing a module that will have two classes ('runners') I am calling them, as they will ultimately use subprocess to run a command line program, so they are basically option parsers, etc... As I wrote the second 'runner', I realized many of the methods are going to be the same as the

Re: [Tutor] Finding the differences between two lists

2011-08-25 Thread John
Not entirely sure, but I think it is as simple as: scanResults = open('scanResults.txt', 'r').readlines() verifiedList = open('verifiedList.txt', 'r').readlines() Now both are lists. I assume each mac address is on it's own line? -john On Thu, Aug 25, 2011 at 8:56 PM, Justin Wendl justin.we

Re: [Tutor] help with 'organization'

2011-08-25 Thread John
Ha! Inheritance! On Thu, Aug 25, 2011 at 7:51 PM, John washa...@gmail.com wrote: Hello, I am writing a module that will have two classes ('runners') I am calling them, as they will ultimately use subprocess to run a command line program, so they are basically option parsers, etc... As I

Re: [Tutor] understanding **kwargs syntax

2011-09-08 Thread John
Following up on this... Why does pylint seem to think it is a bad idea? Description ResourcePathLocationType ID:W0142 plot_ts_array_split_x: Used * or ** magic tsplot.py /research.plot line 299PyLint Problem Thanks, john On Thu, Aug 25, 2011 at 10:44

[Tutor] Doctest error!

2011-11-17 Thread John
Hi all, When i run a doctest on this piece of code (shown at bottom) i get this error message [from the doctest]: Trying: rot13('5 The Parade') Expecting: '5 Gur Cnenqr' ** File F:\Uni\Rot13_1.py, line 12, in

[Tutor] IndexError: list index out of range

2011-11-21 Thread John
Hi all, I have wriiten the following code: [Segment] def survivor(names, step): index = step - 1 next = names while len(next) 1: next.remove (next[index]) However when ever i run it i get this error message: Traceback (most recent call last): File pyshell#46, line

[Tutor] Python code trouble!

2011-11-21 Thread John
Hi all, I have attempted to create a programme which removes every Nth person from the list until there is only one name remaining. N is inputted by the user. Here is the code: def survivor(names, step): next = names while len(next) 1: index = step - 1 next.remove

Re: [Tutor] newbie to gui programming

2010-07-06 Thread John
On Tuesday 06 July 2010 05:35:34 pm Nick Raptis wrote: Please excuse if I'm jumping on the topic. Haven't done any GUI work so this interests me too. wxPython always seemed a great choice as it works on all platforms, and uses GTK+ for linux. Well, what mainly bugs me about wxPython is that

Re: [Tutor] Writing Scripts.

2010-10-24 Thread John
Autumn, Here's a basic script, if you save this in a file called hello.py and type 'python hello.py' at the prompt, or as others are saying using the python launcher, you should get some output. hth, john SCRIPT (include lines below here): #!/usr/bin/env python import os user = os.environ.get

Re: [Tutor] pythonpath

2010-11-01 Thread John
Chris, I haven't worked on windows in ages, but I think you can set a PYTHONPATH variable if you right click on My Computer and maybe the advanced tab, there is a place to set ENVIRONMENT VARIABLES. Create a new one called PYTHONPATH pointing to your directory. -john On Mon, Nov 1, 2010 at 10

Re: [Tutor] pythonpath

2010-11-01 Thread John
hehe. yeah, I had to go check my old PC that's collecting dust on how to navigate the 'happy dungeon' of windows wizards... I do prefer: export PYTHONPATH=/my/custom/dir On Mon, Nov 1, 2010 at 11:03 PM, Vince Spicer vi...@vinces.ca wrote: On Mon, Nov 1, 2010 at 4:00 PM, Vince Spicer

[Tutor] mutable types

2010-11-02 Thread John
Hello, I thought the following should end with G[1] and G[0] returning 20. Why doesn't it? In [69]: a = 10 In [70]: G = {} In [71]: G[0] = [a] In [72]: G[1] = G[0] In [73]: a = 20 In [74]: G[1] Out[74]: [10] In [75]: G[0] Out[75]: [10] ?? ___ Tutor

[Tutor] normalize an array

2010-11-26 Thread John
I know this is a simple problem, but I want to do it the most efficient way (that is vectorized...) import numpy as np a = np.array(([1,2,3,4],[1,.2,3,4],[1,22,3,4])) b = np.sum(a,axis=1) for i,elem in enumerate(a): a[i,:] = elem/b[i] suggestions?

Re: [Tutor] normalize an array

2010-11-27 Thread John
Thank you both! Broadcasting is a concept I hadn't yet read about, but knew was important for efficient python programming... thanks for the link! On Sat, Nov 27, 2010 at 6:44 PM, Eike Welk eike.w...@gmx.net wrote: Hello John! On Friday 26.11.2010 23:23:51 Peter Otten wrote: John wrote: I

[Tutor] modified dictionary class

2010-12-06 Thread John
Hello all, I have been using this class extensively in my modules / scripts. It provides the ability to .reference dictionary values. I find it handy, but am afraid it may come back to haunt me at some point. Is there anything wrong with using this? class Structure(dict): A 'fancy'

Re: [Tutor] modified dictionary class

2010-12-06 Thread John
(object): pass Then, you could easily say: S = Structure() S.this = ['my slice of cheese'] and perhaps I would be being more 'pythonic'?? This I could quite easily do, as, where I have used this class, I almost never actually use the 'dictionary' like referencing... --john On Mon, Dec 6, 2010

Re: [Tutor] calling a method within a function

2010-12-08 Thread John
...@btinternet.com wrote: John washa...@gmail.com wrote I have a strange problem with a piece of code I've written. It's a bit overly complicated to make an example with, but the gist is below. But in the example below, it works. However, in my example, when I call the method from within the function

[Tutor] Odd behavior with eval, list comps, and name lookup

2011-02-18 Thread John
I noticed some odd behavior relating to eval(). First, a baseline case for behavior: def test(): ... x = 5 ... return [a for a in range(10) if a == x] ... test() [5] So far so good. Now let's try eval: c = compile('[a for a in range(10) if a == x]', '', 'single') eval(c, globals(), {'x':

Re: [Tutor] Question from a newbie

2009-07-22 Thread John
On Tuesday 21 July 2009 11:12:23 am Deb wrote: My son suggested I play around with Python. I was wondering if anybody has any real life applications? It appears to be able to do quite a lot, but is anybody really doing it with Python? I am very curious about this language. I used to be a

[Tutor] python and java report writers

2009-08-17 Thread John
Hi, I have been searching for a report writer to work with my python programs. I did find reportlab. But most of the other report writers are java based. I am confused by all the jargon associated with Java and have very little working knowledge of the environment. So I'm hoping someone

Re: [Tutor] python and java report writers

2009-08-17 Thread John
On Monday 17 August 2009 01:08:15 pm Oxymoron wrote: (Posting to list!) On Tue, Aug 18, 2009 at 6:01 AM, Johnjfabi...@yolo.com wrote: First I love your handle.  And second, thanks for taking the time to explain :-) : jython world.  But I was really looking for a simple way of calling

Re: [Tutor] python and java report writers

2009-08-17 Thread John
On Monday 17 August 2009 05:43:05 pm Kent Johnson wrote: Forwarding to the list with my reply. On Mon, Aug 17, 2009 at 4:04 PM, John jfabi...@yolo.com wrote: Thanks for taking the time to write. But I was really looking for a simple way of calling a report writer (like using a com object

[Tutor] real world decorators

2009-09-20 Thread John
Hi, I think I understand what decorators are and how they work. Maybe it's just me but I don't know where I'd use them in my real world programming. I see how they work with profile or coverage but does anyone have real world uses. I mostly create wxPython apps and don't see where they

Re: [Tutor] real world decorators

2009-09-21 Thread John
On Sunday 20 September 2009 03:43:32 pm Eike Welk wrote: On Sunday 20 September 2009, John wrote: Hi, I think I understand what decorators are and how they work. Maybe it's just me but I don't know where I'd use them in my real world programming. I see how they work with profile

Re: [Tutor] Porting PHP web app to Python GUI

2009-10-12 Thread John
On Monday 12 October 2009 05:17:16 am Dotan Cohen wrote: I have a simple PHP web application with a form, which enter the information entered into the form into a database. However, I will be several weeks without internet access so I now have two choices: 1) Run the script locally on my

[Tutor] cross platform authenticating

2009-10-20 Thread John
Hi, Is there a general discussion (somewhere on the web) on how to 1. determine what authentication the platform requires 2. can #1 be determine dynamically 3. If I know #1 will it be cross platform? Googling reveals that there are many authenticating modules, LDAP, PAS, RADIUS, Active

Re: [Tutor] cross platform authenticating

2009-10-20 Thread John
On Tuesday 20 October 2009 12:41:28 pm Alan Gauld wrote: John jfabi...@yolo.com wrote As you guys can see I'm just starting out in the authentication world. This is a list for beginners in Python not authentication. You would probably be better off posting on a security or authentication

[Tutor] replacing a long list of if,elif

2009-10-23 Thread John
I'm using python 2.5 I have a long list of if, elif, else. I always thought it was very NOT pythonic. It's easy to read but not pretty. for fldType in fieldList: if int in fldType: fld = I elif char in fldType : fld = C elif bool in fldType : fld = B . else:

Re: [Tutor] replacing a long list of if,elif

2009-10-23 Thread John
On Friday 23 October 2009 08:05:29 am John wrote: I'm using python 2.5 I have a long list of if, elif, else. I always thought it was very NOT pythonic. It's easy to read but not pretty. for fldType in fieldList: if int in fldType: fld = I elif char in fldType : fld = C

Re: [Tutor] How to load a dict into a dict subclass?

2009-10-27 Thread John
I use a 'SuperDict' all the time in my code. Not sure it's a good idea, but I find it convenient. Also, I wouldn't mind comments on why/why not to use something like this: class SuperDict(dict): def __getattr__(self, attr): return self[attr] def __setattr__(self, attr, value):

Re: [Tutor] How to load a dict into a dict subclass?

2009-10-27 Thread John
On Tuesday 27 October 2009 06:25:13 am John wrote: I use a 'SuperDict' all the time in my code. Not sure it's a good idea, but I find it convenient. Also, I wouldn't mind comments on why/why not to use something like this: class SuperDict(dict): def __getattr__(self, attr

[Tutor] how to access deep classes

2009-11-20 Thread John
Hi, I'm not to sure I can explain myself. But I need to ask because I do not understand how it works or what is possible. class A (wx.Panel); def__init__(...) class B(wx.PyPanel): def __init__(..): self.pages = A(...) class C (B) def __init__(...) I can't change the code in

Re: [Tutor] how to access deep classes

2009-11-20 Thread John
On Friday 20 November 2009 04:48:59 am Lie Ryan wrote: Is this what you want? class C(B):     �...@property      def wxpanelFontSize(self):          return self.pages.wxpanelFontSize     �...@wxpanelfontsize.setter      def wxpanelFontSize(self, value):          self.pages.wxpanelFontSize

Re: [Tutor] how to access deep classes

2009-11-20 Thread John
On Friday 20 November 2009 09:48:38 am Alan Gauld wrote: John jfabi...@yolo.com wrote class A (wx.Panel); def__init__(...) class B(wx.PyPanel): def __init__(..): self.pages = A(...) class C (B) def __init__(...) I can't change the code in either class A or class

[Tutor] win32com and ocx with properties

2009-12-09 Thread John
I realize that some may consider this an advance question. But there are many here that are advance. So I'm hoping some nice soul will help me. I'm attempting to use a OCX designed to talk with QuickBooks. I'm using win32com for the first time and have discovered an issue that I'm sure

Re: [Tutor] win32com and ocx with properties

2009-12-09 Thread John
On Wednesday 09 December 2009 01:45:38 pm bob gailer wrote: John wrote: I realize that some may consider this an advance question. But there are many here that are advance. So I'm hoping some nice soul will help me. I'm attempting to use a OCX designed to talk with QuickBooks. I'm

Re: [Tutor] Entry-level open source opportunities

2009-12-15 Thread John
On Tuesday 15 December 2009 09:20:16 am bob gailer wrote: Kent Johnson wrote: OpenHatch is a new web site that compiles entry-level opportunities with open-source programming projects. Many of the projects are in Python. If you are looking for a way to get involved with an open source

[Tutor] lazy? vs not lazy? and yielding

2010-03-03 Thread John
Hi, I just read a few pages of tutorial on list comprehenion and generator expression. From what I gather the difference is [ ] and ( ) at the ends, better memory usage and the something the tutorial labeled as lazy evaluation. So a generator 'yields'. But what is it yielding too? John

Re: [Tutor] python magazine

2010-03-26 Thread John
On Friday 26 March 2010 08:33:35 am Lowell Tackett wrote: From the virtual desk of Lowell Tackett  --- On Fri, 3/26/10, Bala subramanian bala.biophys...@gmail.com wrote: From: Bala subramanian bala.biophys...@gmail.com Subject: [Tutor] python magazine To: tutor@python.org Date: Friday,

Re: [Tutor] Help with choices for new database program

2010-07-03 Thread John
On Friday 02 July 2010 08:19:24 pm bob gailer wrote: On 7/2/2010 5:56 PM, Jeff Johnson wrote: [snip] Visual FoxPro ... is very similar to Access I differ. Access and FoxPro are very different. Yes they both use tables, relationships, indexes and SQL. Yes they both have visual designers

[Tutor] python 2.7.1

2012-09-06 Thread john
print hello world #this is just something to say /Users/jonathan/Documents/hello.py File stdin, line 1 /Users/jonathan/Documents/hello.py ^ SyntaxError: invalid syntax what am i doing wrong? ___ Tutor maillist - Tutor@python.org To

[Tutor] pywinauto for OS X and Linux?

2007-05-18 Thread John
I have been playing with pywinauto http://pywinauto.pbwiki.com/ for a few hours. Pywinauto allows you to use python to automate the GUI of Windows using Python in very intuitive ways. What are the closest analogs for this under OS X and Linux? John

[Tutor] I'm clearly not getting an important pygtk concept

2007-05-25 Thread John
unfortunately. Sometimes pressing the button registers in my logs and sometimes it does not. Pressing the button twice in rapid succession may cause a hit to register if a single click did not. Pressing the button 5 or 6 times will cause 4 or 5 hits. What is it I am not understanding? John

[Tutor] what tools will i need to start my project ?

2006-03-19 Thread John
i'm new to programming and decided to go with python as my first language. my goal is to create an excel macros that will grab information from an html file and import it into my worksheet. I figure i should first start apart from excel then work on making it work with it (if it is even

[Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
all North. However, the West / East issue is another story. Anyone have a more elegant solution? -john ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
Just a quick follow up.. it doesn't work :s There are definitely some problems... ideas are welcome! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
Weiss [EMAIL PROTECTED] wrote: John: One way to handle the situation of longitude is to make everything west of the Greenwich meridan a negative value until -180 degrees and everything east of Greenwich a positive value. HTH. Albert *John [EMAIL PROTECTED]* Sent by: [EMAIL PROTECTED

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
A little closer, this seems to work, but it's not catching the 'W' or 'S' cases to make it negative... for i in range(0,20): y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=int(y[0].rstrip()),float(y[1].strip('\' N')) xdeg,xmin=int(x[0].rstrip()),float(x[1].rstrip(\'

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
I will work with this further, and report back once I find Alan's method... but for now, this seems to work: for i in range(0,20): y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=int(y[0].rstrip()),float(y[1].strip('\' N')) xdeg,xmin=int(x[0].rstrip()),float(x[1].rstrip(\' E).rstrip(\'

Re: [Tutor] green brackets?

2007-07-11 Thread John
This is how you put a newline or linebreak in a string: \n -just adding that for someone's search later on, since 'newline' and 'linebreak' hadn't been mentioned yet ;) (Should I be doing something else!?) ___ Tutor maillist - Tutor@python.org

[Tutor] binary data struct module

2007-09-03 Thread John
Hello, I have an unformatted mixed type binary file I'm trying to read into Python. So far, I've gotten as far as: f2=file(infile,'rb') Dfmt=['3i','13s','7i','2f','2i','2f','2i','i'] #format for binary reading first bits if f2: print infile + ' has been opened' #for ft in Dfmt: #

[Tutor] more on reading binary... a better way?

2007-09-05 Thread John
Hello everyone, Here's my solution for reading binary data (unformatted mixed types) and packing it into a dictionary. It works, but somehow doesn't seem so 'pythonic'. Just seeking comments on how I might make it more efficient. Thanks! def readheader(filename): import struct

[Tutor] dynamic attribute assignment

2007-09-06 Thread John
I've just noticed that you can use the import statement to import variables, such that a simple file such as vars.py: # File with predefined variables var1= 'some text' var2= 2 var3=['a','b','c'] Would then, upon import, provide: vars.var1 'some text' vars.var2 2 vars.var3 ['a','b','c'] This

[Tutor] 2.5 to 2.4 problem with Int

2007-09-13 Thread John
I've written a program which calculates areas of grid cells distributed over the globe. It works fine with Python 2.5, however, when I run it with 2.4(the Enthon edition) I get the following error: OverflowError: long int too large to convert to int It occurs on this line: for ix in range(nx):

Re: [Tutor] 2.5 to 2.4 problem with Int

2007-09-13 Thread John
to 10, but why?? It wasn't a problem before and it's not a problem for ix??? Thanks! On 9/13/07, Kent Johnson [EMAIL PROTECTED] wrote: John wrote: I've written a program which calculates areas of grid cells distributed over the globe. It works fine with Python 2.5, however, when I run

Re: [Tutor] 2.5 to 2.4 problem with Int

2007-09-13 Thread John
In all it's glory: I'm just a bit embarrassed because I'm sure it's poor coding: def gridarea(H): returns an array of area corresponding to each nx,ny,nz %=== % %--- % input % - H : Header dict object with

[Tutor] summing arrays, along a dimension

2007-09-14 Thread John
d array([[0, 0, 1], [1, 2, 3], [2, 2, 4], [3, 6, 8]]) e=reshape((d[:,-2]+d[:,-1]),(4,1)) e array([[ 1], [ 5], [ 6], [14]]) is there a better way to accomplish this? ___ Tutor maillist - Tutor@python.org

[Tutor] referencing vars()

2007-09-15 Thread John
#Set up writer import csv vardict=vars() for var in vardict: if var=='allcum' or var=='alldhdt': outfile=in_path+'/'+dataset+'_'+str(var)+'.csv' writer = csv.writer(open(outfile, wb))

Re: [Tutor] referencing vars()

2007-09-17 Thread John
Kent, Thanks this is exactly the solution I am looking for... so simple. On 9/15/07, Kent Johnson [EMAIL PROTECTED] wrote: John wrote: #Set up writer import csv vardict=vars() for var in vardict: if var=='allcum' or var=='alldhdt

[Tutor] URLLIB / GLOB

2007-10-22 Thread John
Hello, I would like to write a program which looks in a web directory for, say *.gif files. Then processes those files in some manner. What I need is something like glob which will return a directory listing of all the files matching the search pattern (or just a simply a certain extension). Is

[Tutor] 'source' in python or preloading variables

2007-10-27 Thread John
I have a file sitelocations: STN_id[1]=AAA STNlat[1]=58.80 STNlon[1]=17.40 STNelv[1]=20 STN_id[2]=BBB STNlat[2]=42.45 STNlon[2]=25.58 STNelv[2]=2925 which in shell scripts I can simple 'source'. In Python I have to: sitesFile=file('sitelocations','r') sites=sitesFile.readlines()

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread John
can interchange the lines without breaking the logic. Caveat - list in python starts at 0 index so STN_id[1] is not the first element but the second element. But you can filter unwanted items from the list if you want as in - [ x for x in STN_id if x != 0 ] HTH Aditya On 10/27/07, John

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread John
] is not the first element but the second element. But you can filter unwanted items from the list if you want as in - [ x for x in STN_id if x != 0 ] HTH Aditya On 10/27/07, John [EMAIL PROTECTED] wrote: I have a file sitelocations: STN_id[1]=AAA STNlat[1]=58.80 STNlon

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread John
The problem is the infies are also being used in a shell scripted environment, they are frequently updated and cannot be changed. So ideadly I could just define a function which sourced the file, assuming the variable names passed in the *args list. So, yes, I know the names, they just haven't

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread John
Note, i need the ns+1 because the 'source files are not zero indexed. On 10/27/07, John [EMAIL PROTECTED] wrote: Here's where I am: def source(filename, vList): takes a file object and a list of variables as input import re # Read the file fid=open(filename,'r') lines

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread John
Thanks, it's strange, it works within a script defined at the top, but if I try to import it from a module it fails: NameError: name 'files' is not defined On 10/27/07, Aditya Lal [EMAIL PROTECTED] wrote: On 10/27/07, John [EMAIL PROTECTED] wrote: Note, i need the ns+1 because

Re: [Tutor] system call

2007-10-27 Thread John
I have the exact same situation, but system doesn't seem to wait. Here is my pseudo code: for i in attempts: #attempts holds strings of shellscripts cmd=%s which runs many different shell scripts and takes about an hour % (i) os.system(cmd) #debugging print

Re: [Tutor] system call

2007-10-28 Thread John
Here is my actual code (a section of a long script): if os.path.isdir(ad) and aRun.split('_')[0]==STN_id[i] and in (aRun.split ('_')[1]): make_pages=os.path.join(BASEDIR,STN_id[i],SUBDIR[1],'make_pages') sedstr1=cat %s | sed -e 's/ASYSmin=[0-9][0-9]*/ASYSmin=%s/g' jnk %

Re: [Tutor] 'source' in python or preloading variables

2007-10-28 Thread John
But won't if fail since the variabls in the file are not quoted? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] killing bash, sshd... dangerous?

2007-10-28 Thread John
Hello, I've written a little script with the intention of killing all of my bash, sshd sessions... is this dangerous? How could I make it work so that it didn't kill the session it was run from (as it is I suppose I have to run it with nohup): #!/usr/bin/env python import os cmd=ps -u myuser |

Re: [Tutor] killing bash, sshd... dangerous?

2007-10-28 Thread John
this functionality already. On 10/28/07, John [EMAIL PROTECTED] wrote: Hello, I've written a little script with the intention of killing all of my bash, sshd sessions... is this dangerous? How could I make it work so that it didn't kill the session it was run from (as it is I suppose I have

[Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread John
Does anyone have an idea why I can't do this? for k in range(nr): contribution=N.zeros(shape(H['area'])) contribution=[contribution+grid[:,:,z:,k,0]/A for z in range(len(H['outheight']))] zplot[:,:,k]=zplot[:,:,k]+contribution; And on the interactive line: shape(contribution) (360, 180)

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread John
Sorry, here's the output from the command line run Day_footprint.py trying... header has been opened succes! Reading grid 2006051100 at: Mon Oct 29 16:57:57 2007 processing: 2006051100 Traceback (most recent call last): File Day_footprint.py, line 48, in ?

Re: [Tutor] calculation with arrays: shape mismatch

2007-10-29 Thread John
Well, To be honest, part of the problem is that I work in about four different Python environments!! I've had a hard time getting the scipy suite to work fully on windows, and for number crunching it's just easier to run in linux. This here was just a cut from running a script I wrote at the DOS

[Tutor] Automating operations... os module, mysql operations, more...

2007-11-01 Thread John
I should begin by explaining I am not a sysadmin, I'm merely one trying to use the right tool for the right job, and for my job I believe Python to be that tool. Here is an outline of what I wish to accomplish, pointers to modules, tools of interest, etc. would be greatly appreciated... Below each

Re: [Tutor] Automating operations... os module, mysql operations, more...

2007-11-01 Thread John
2) Query various servers to see if there is 'idyl' time/resources... send a job to the server if it's available... This and 3 can be helped out with ipython 3) Use python to check the file system for existing files (glob?) , decide which 'jobs' need to be run, etc. -os, sys,

[Tutor] subprocess stdout nohup question

2007-11-02 Thread John
When I run a python script with nohup, my print statements are not being written to nohup.out, why is that? Should nohup.out capture all stdout statements? -- Configuration `` Plone 2.5.3-final, CMF-1.6.4, Zope (Zope 2.9.7-final, python 2.4.4, linux2), Five 1.4.1, Python

Re: [Tutor] Help with setting path

2007-11-02 Thread John
How did you install Python? I've found that the Enthought distribution to be the simplest and quickest way to get up and running while having good functionality (i.e. scipy up and running). Active state releases a good version as well... and thus, welcome, to what in my humble opinion (a newbie

Re: [Tutor] Help with setting path

2007-11-03 Thread John
Good point, I think that goes for learning a programming language in general ;) Find one that works, and master it... I'm starting to put together the picture of what a Python installation is, but I have to admit, when you work on multiple machines regularly, it is a bit challenging. Especially

[Tutor] Some question about OO practice

2007-11-04 Thread John
I've now written my first set of Classes to do some fairly specific processing for work I do. I have a few questions. First, in looking through what I've done, I basically just incorporated all my previous scripts into classes... they are still highly specific to my application, though I did try

Re: [Tutor] 'source' in python or preloading variables

2007-11-04 Thread John
Does anyone know why the script below works fine (in regards to the 'source function') but when I try to uncomment the line from mymod import source and use it that way without defining the function in the script, I get an error that N_id does not exist. It must have something to do with namespace

Re: [Tutor] Some question about OO practice

2007-11-04 Thread John
or for args: myFunc(a,b,c, etc.) It is correct that you need to use the '**' in the 'calling' statement? On Nov 4, 2007 2:31 PM, Kent Johnson [EMAIL PROTECTED] wrote: John wrote: I've now written my first set of Classes to do some fairly specific processing for work I do. I have a few

Re: [Tutor] reading and writing with csv then appending some data to a specific line

2007-11-04 Thread John
Remember to seek to the end of the file before you start writing. See: http://mail.python.org/pipermail/python-list/2000-August/048839.html ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] subprocess help, nohup

2007-11-13 Thread John
Hello, I've written a script which conducts several subprocess calls and then ultimately calls a shell script which runs even more programs... my script is using subprocess to execute a few sed calls, and then execute the script. I'm getting strange behavior: Here's a snippet of my script (any

[Tutor] MySQLdb install issue

2008-01-15 Thread John
Hello, Does anyone know how to install MySQLdb into a python installation when the machine you are working on does not have MySQL installed? I.E. the MySQL installation is on a different server, but the site.cfg file for the MySQLdb installation asks for the location of the mysql_config: # The

Re: [Tutor] help with slice

2008-04-02 Thread John
Thanks all for the posts, I guess I'm thinking in 'matrices' and in a matlab syntax. So I was trying to get the third element of a list of lists, or lists in a dictionay in syntax like matlab (yes, I should be using numpy or scipy). Anyway, Alan's final suggestion (and everyone else's) has

Re: [Tutor] GUI development with Python 3.4.1

2014-09-18 Thread john
On 09/18/2014 06:07 AM, Juan Christian wrote: On Wed, Sep 17, 2014 at 2:01 PM, Juan Christian juan0christ...@gmail.com mailto:juan0christ...@gmail.com wrote: I need to develop a GUI for my Python pogram, I already read the GuiProgramming page

Re: [Tutor] about the gui development

2015-06-13 Thread john
Interesting question - what will be the end platform. If you really want a python solution: Tablets. phones, desktops - Kivy (very promising) Tablets. phones, desktops - PyQt Desktops - wxPython, tk, Dabo (python 2.7 at the moment) All the other GUI frameworks either have a very small following

Re: [Tutor] Python excel filter

2015-10-26 Thread john
take a look at python-excel xlwt is what I use. BTW there are others Johnf On 10/26/2015 05:21 AM, Lucas Mascia wrote: Hello, I would like some guidance in a way to filter data from an excel sheet (.xlsx) I will be exporting an extensive table from a website with 400x20 infos. In this

Re: [Tutor] UPDATE, pyhthon+postgre

2016-06-01 Thread john
cursor1.execute("""UPDATE employee SET name=%s, add=%s, add1=%s, city=%s, state_county=%s, country=%s, basic=%s, WHERE group_code = %s""" % (name,add,add1,city,state_county,country,basic,grpCode)) It appears that you are not required to provide any time or date since you created a default. Of

Re: [Tutor] Best tool for programming interactive games in Python

2016-03-30 Thread john
On 03/30/2016 04:27 AM, wolfrage8...@gmail.com wrote: I have a few students who are interested in creating interactive games in Python. We have learned how to use tkinter but we are looking for something more robust. I tried using pygame I recommend Kivy; because then it is easy to take the

[Tutor] sub-modules and python3

2017-05-31 Thread john
Hi folks, In the past I used a simple "import filename" for sub-modules in python 2. With python 3 I have run into errors reported (file not found) using python 2 import statements. But I'm not asking how to correct the import as I am able to change the way I write the import as a work

[Tutor] maximum value in a Numeric array

2004-12-10 Thread Ertl, John
All, I am trying to get the maximum value in a 2-D array. I can use max but it returns the 1-D array that the max value is in and I then I need to do max again on that array to get the single max value. There has to be a more straightforward way...I have just not found it. b =

[Tutor] turning a number into a formated string

2004-12-15 Thread Ertl, John
22.33 needs to look like 00223330 .22 needs to look like 2200 Any ideas on the right padding the decimal side using 0 Thanks, John ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

[Tutor] Regexp Not Matching on Numbers?

2004-12-14 Thread Gooch, John
This is weird. I have a script that checks walks through directories, checks to see if their name matches a certain format ( regular expression ), and then prints out what it finds. However, it refuses to ever match on numbers unless the regexp is .*. So far I have tried the following regular

RE: [Tutor] removedirs ?

2004-12-16 Thread Ertl, John
...but the straight forward path might be the best. Thanks, John Ertl -Original Message- From: Jason Child [mailto:[EMAIL PROTECTED] Sent: Thursday, December 16, 2004 12:36 Cc: [EMAIL PROTECTED] Subject: Re: [Tutor] removedirs ? Ertl, John wrote: I am trying to remove a directory

  1   2   3   4   5   6   7   8   9   10   >