Re: how to import MV module

2009-05-14 Thread MRAB
guangshan chen wrote: Hi all, I am new. I just want to run a python program. When I run it, python can not find MV module. The follow is the error information: Traceback (most recent call last): File "MakeCouplerRestart.py", line 22, in import MV,struct,Numeric,string ImportError: No m

Re: Returning dictionary from a function

2009-05-14 Thread Jeff McNeil
On May 14, 5:44 pm, kk wrote: > Btw my main problem is that when I assign the function to 'b' variable > I only get the last key from the dictionary. Sorry about that I forgot > to mention the main issue. You're creating a new dictionary with each iteration of your loop, use d[k] = v syntax inst

Re: Returning dictionary from a function

2009-05-14 Thread Diez B. Roggisch
kk schrieb: Hi I am working on something here and I cannot get the full dictionary out of a function. I am sure I am missing something here. Anyways here is a simple code that repeats my problem. Basically I am just trying to get that values function to return the diky as a dictionary so that I

Re: putting date strings in order

2009-05-14 Thread noydb
On May 14, 4:13 pm, Scott David Daniels wrote: > Peter Otten wrote: > > Hm, if ordered_raster_list is guaranteed to contain one string item for > > every month the above can be simplified to > > > months = [ > >     'precip_jan', 'precip_feb', 'precip_mar', 'precip_apr', > >     'precip_may', 'pre

Re: Returning dictionary from a function

2009-05-14 Thread smard...@gmail.com
def values(x): diky={} for a in range(x): a=a+100 diky[chr(a)] = a return diky it is not working b/c you are creating a new dictionary with each iteration of the loop, rather you want to update the same dictionary with the new value you have.. -- http://mail.python.org

Re: Returning dictionary from a function

2009-05-14 Thread bearophileHUGS
kk: >I am sure I am missing something here.< This instruction created a new dicky dict for every iteration: diky={chr(a):a} What you want is to add items to the same dict, that you later output. The normal way to do it is: diky[chr(a)] = a Your fixed code: def values(x): diky = {} for i

Re: Returning dictionary from a function

2009-05-14 Thread MRAB
kk wrote: Hi I am working on something here and I cannot get the full dictionary out of a function. I am sure I am missing something here. Anyways here is a simple code that repeats my problem. Basically I am just trying to get that values function to return the diky as a dictionary so that I c

Python-URL! - weekly Python news and links (May 14)

2009-05-14 Thread Gabriel Genellina
QOTW: "Tail recursion *unifies* message passing and function calling. *This* is the reason tail recursion is cool." - JRM http://funcall.blogspot.com/2009/05/you-knew-id-say-something-part-iii.html First beta of Python 3.1 released http://groups.google.com/group/comp.lang.python/

Re: Nimrod programming language

2009-05-14 Thread MRAB
bearophileh...@lycos.com wrote: Piet van Oostrum: You may not have seen it, but Fortran and Algol 60 belong to that category. I see. It seems my ignorance is unbounded, even for the things I like. I am very sorry. Some early versions of Basic were also flexible when it came to spaces. The ex

Re: Returning dictionary from a function

2009-05-14 Thread kk
Hi Thank you so much. It makes perfect sense. I actually tried the second suggested syntax before posting here but it was inside of my actual code which probably had another problem. The suggested solution works perfectly. thanks again -- http://mail.python.org/mailman/listinfo/python-list

Re: Q's on my first python script

2009-05-14 Thread Marius Gedminas
On May 11, 12:30 pm, Nick Craig-Wood wrote: >     def __init__(self): >         usage = '''Usage: %prog [options] YYMMDD >            %prog -h|--help > ''' >         parser = OptionParser(usage=usage) >         parser.add_option("-n", "--no-newline", dest="nonl", >                           action

Re: Q's on my first python script

2009-05-14 Thread Marius Gedminas
On May 10, 6:56 pm, Steven D'Aprano wrote: > > 4. What's the python way to emit warnings?  (The script below should > >    warn the user that arguments after the first one are ignored.) > > import warnings > warnings.warn("The end of the world is coming!") The warnings module is used for warnings

Re: how to import MV module

2009-05-14 Thread guangshan chen
Hi MRAB, Thanks. That is not what I am doing. It seems only there is MV module used. I also googled a lot. I just try to delete MV in the program. I found the program still can be run without any problem. So maybe the MV module is not used. Guangshan On May 14, 2009, at 5:04 PM, MRAB wrote:

Re: Returning dictionary from a function

2009-05-14 Thread John Machin
On May 15, 7:38 am, kk wrote: > Hi > > I am working on something here and I cannot get the full dictionary > out of a function. I am sure I am missing something here. > > Anyways here is a simple code that repeats my problem. Basically I am > just trying to get that values function to return the d

Circular relationship: object - type

2009-05-14 Thread Mohan Parthasarathy
Hi, I have read several articles and emails: http://www.cafepy.com/article/python_types_and_objects/python_types_and_objects.html#relationships-transitivity-figure http://mail.python.org/pipermail/python-list/2007-February/600128.html I understand how type serves to be the default metaclass whe

Re: py2exe + win32com + DAO

2009-05-14 Thread Trevor
I think the problem I am experiencing bears a resemblance to the content of this post: http://mail.python.org/pipermail/python-list/2001-February/071421.html Does anyone know what the GUID for the DAO 3.6 library is (or can explain how I can find it)? On May 12, 11:00 pm, David Lyon wrote: > On

Re: Returning dictionary from a function

2009-05-14 Thread kk
John, Thanks for pointing out the loop issue. I just typed these sloppy lines the demonstrate the issue, they were not part of any code by any means. I will make sure that I will post cleaner lines next time. -- http://mail.python.org/mailman/listinfo/python-list

Python system with exemplary organization/coding style

2009-05-14 Thread TomF
I'm looking for a medium-sized Python system with very good coding style and good code organization, so I can learn from it. I'm reading various books on Python with advice on such things but I'd prefer to see a real system. By medium-sized I mean 5-20 classes, 5-20 files, etc; a code base th

Re: Python system with exemplary organization/coding style

2009-05-14 Thread CTO
On May 14, 7:01 pm, TomF wrote: > I'm looking for a medium-sized Python system with very good coding > style and good code organization, so I can learn from it.  I'm reading > various books on Python with advice on such things but I'd prefer to > see a real system. > > By medium-sized I mean 5-20

Re: Representing a Tree in Python

2009-05-14 Thread Benjamin Edwards
On May 13, 8:27 pm, CTO wrote: > On May 13, 8:19 am, bearophileh...@lycos.com wrote: > > > godshorse, you may use the "shortestPaths" method of this graph class > > of mine:http://sourceforge.net/projects/pynetwork/ > > > (It uses the same Dijkstra code by Eppstein). > > (Once you have all distanc

Re: how to import MV module

2009-05-14 Thread MRAB
guangshan chen wrote: Hi MRAB, Thanks. That is not what I am doing. It seems only there is MV module used. I also googled a lot. I just try to delete MV in the program. I found the program still can be run without any problem. So maybe the MV module is not used. From the trackback I can see

Re: New to python, can i ask for a little help?

2009-05-14 Thread Andrew Chung
Thank you to all who responded. You were right about the solution. That helped alot. Now maybe i can ask if anyone has any ideas for learning, such as websites or videos. I found one that i liked alot. http://iamar.net/subpages/PythonVid.html But i wondered how other people learned as beginners i

Re: [ANN] Introduction to Python course, San Francisco, Jun 2009

2009-05-14 Thread wesley chun
* FINAL REMINDER * we have about 10-15 spaces remaining for our June course coming up in about a month. if you have coworkers or colleagues that need to learn Python, the weather is great up here in northern california in the city by the bay. there are discounts for students and teachers, as well

Re: How to get the formal args of a function object?

2009-05-14 Thread Scott David Daniels
norseman wrote: Scott David Daniels wrote: kj wrote: Suppose that f is an object whose type is 'function'. Is there a way to find out f's list of formal arguments?... I can write a wrapper now: def tracer(function): def internal(*args, **kwargs): print('calling %s(%s)'

Re: Odd list behavior

2009-05-14 Thread Rhodri James
On Thu, 14 May 2009 17:49:33 +0100, norseman wrote: Rhodri James wrote: On Wed, 13 May 2009 23:08:26 +0100, norseman wrote: Evan Kroske wrote: I'm working on a simple file processing utility, and I encountered a weird error. If I try to get the first element of a list I'm splitting fr

Re: How to get all named args in a dict?

2009-05-14 Thread John Machin
On May 15, 6:24 am, Jason Tackaberry wrote: > On Thu, 2009-05-14 at 20:15 +, kj wrote: > > That problem is easily solved: just make "x = locals()" the first > > statement in the definition of foo. > > That doesn't solve the problem.  You'd need locals().copy() Dave's solution doesn't formally

Re: How to get all named args in a dict?

2009-05-14 Thread Dave Angel
kj wrote: In Dave Angel writes: kj wrote: In Terry Reedy writes: kj wrote: Suppose I have the following: def foo(x=None, y=None, z=None): d = {"x": x, "y": y, "z": z} return bar(d) I.e. foo takes a whole bunch of named arguments and ends up

Re: Need advice on distributing small module

2009-05-14 Thread Carl Banks
On May 14, 1:26 pm, kj wrote: > I've written a tiny module that I'd like to make available online > from my website.  This module is not "production-grade" code; it > is meant only as an illustration, but still I'd like to make its > download and installation as painless as possible. > > I could s

Re: introspection question: get return type

2009-05-14 Thread George Sakkis
On May 14, 3:55 pm, a...@pythoncraft.com (Aahz) wrote: > In article <4a0c6e42$0$12031$426a7...@news.free.fr>, > Bruno Desthuilliers   wrote: > > >Marco Mariani a écrit : > >> Bruno Desthuilliers wrote: > > >>> Oh, you meant the "return type" ? Nope, no way. It just doesn't make > >>> sense given Py

Re: capture stdout and stderror from within a Windows Service?

2009-05-14 Thread David Lyon
On Thu, 14 May 2009 11:16:51 -0500, Grant Edwards wrote: > On 2009-05-14, Chris Curvey wrote: >> I'm trying to get this invocation right, and it is escaping me. How >> can I capture the stdout and stderr if I launch a subprocess using >> subprocess.check_call()? The twist here is that the call

Re: How to get all named args in a dict?

2009-05-14 Thread John Machin
On May 15, 10:46 am, Dave Angel wrote: > kj wrote: > > In Dave Angel > > writes: > > >> kj wrote: > > >>> In Terry Reedy > >>> writes: > > kj wrote: > > > Suppose I have the following: > > > def foo(x=None, y=None, z=None): > >     d = {"x": x, "y": y, "z": z} > >     re

Re: (Windows) Finding out which process has locked a file.

2009-05-14 Thread Gabriel Genellina
En Thu, 14 May 2009 08:42:07 -0300, Lawrence D'Oliveiro escribió: In message <787d6072-3381-40bd- af20-8e1a40405...@h23g2000vbc.googlegroups.com>, CinnamonDonkey wrote: I have a script running which occa[s]ionally fails because it is trying to delete a file in use by another process. When this

UpLib 1.7.6 available

2009-05-14 Thread Bill Janssen
I've released the latest version of my UpLib personal digital library system. For those of you unfamiliar with UpLib, here's the abstract: The UpLib personal digital library system provides a secure long-term storage system, and a visually-oriented retrieval mechanism, for a wide variety of

Re: C API: how to replace python number object in place?

2009-05-14 Thread Stephen Vavasis
In my previous posting, I inquired how to change a python numeric object in place. Several people responded that this is not possible. Perhaps I should explain the larger problem that I am trying to solve, and then the solution will become apparent. I have a C routine R that invokes a Python

Re: Call Web Service using proxy and http authentication

2009-05-14 Thread wdveloper
On May 13, 5:26 pm, Steve Howell wrote: > On May 12, 12:51 pm, wdveloper wrote: > > > > > On May 12, 8:38 pm, Steve Howell wrote: > > > > On May 12, 8:59 am, wdveloper wrote: > > > > > Hi everyone, > > > > > I am trying to call a webservice which requires an http > > > > authentication. > > > >

Re: C API: how to replace python number object in place?

2009-05-14 Thread Carl Banks
On May 14, 8:24 pm, vava...@cpu111.math.uwaterloo.ca (Stephen Vavasis) wrote: > In my previous posting, I inquired how to change a python numeric object > in place.  Several people responded that this is not possible.  Perhaps I > should explain the larger problem that I am trying to solve, and the

Re: putting date strings in order

2009-05-14 Thread Peter Otten
noydb wrote: > On May 14, 4:13 pm, Scott David Daniels wrote: >> Peter Otten wrote: >> > Hm, if ordered_raster_list is guaranteed to contain one string item for >> > every month the above can be simplified to >> >> > months = [ >> > 'precip_jan', 'precip_feb', 'precip_mar', 'precip_apr', >> > 'pr

creating python code with dynamic file name

2009-05-14 Thread bijoy franco
hi, How can i create python code, for which filename can be defined on the fly..? for example, in a blog, when each article selected, respective python code with headline of the article as filename should be called. thanks bijoy -- http://mail.python.org/mailman/listinfo/python-list

<    1   2