Re: Why the file mode of .pyc files has x?

2009-09-28 Thread Cameron Simpson
On 26Sep2009 10:24, Peng Yu wrote: | > [st...@sylar test]$ ls -l | > total 16 | > -rw-rw-r-- 1 steve steve  6 2009-09-26 23:06 test.py | > -rw-rw-r-- 1 steve steve 94 2009-09-26 23:08 test.pyc | > | > Have you checked the umask of your system? | | Here are my test case. If the .py file has the 'x

Help required

2009-09-28 Thread waqas ahmad
Hi, I dont know it is the right place to post this question. I need help to change one search code line . can you help me please. here is my search method code: search=re.compile("^#acl InternationalGroup.*\n", re.M).search(pagetext) if search: ret=search.group() else:

removing a post

2009-09-28 Thread Mike L
hello could you remove this old post, off topic and spam http://www.mail-archive.com/python-list@python.org/msg175722.html thank you _ We are your photos. Share us now with Windows L

Re: Twisted PB: returning result as soon as ready

2009-09-28 Thread exarkun
On 25 Sep, 01:25 pm, jacopo.pe...@gmail.com wrote: In the following chunk of code the CLIENT receives both the results from 1Ccompute 1D at the same time (i.e. when the second one has finished). This way it cannot start 1CelaborateResult 1D on the first result while the SERVER is still running

Re: Detecting changes to a dict

2009-09-28 Thread Duncan Booth
Steven D'Aprano wrote: > Is there a fast way to see that a dict has been modified? I don't care > what the modifications are, I just want to know if it has been > changed, where "changed" means a key has been added, or deleted, or a > value has been set. (Modifications to mutable values aren't >

Re: Business issues regarding adapting Python

2009-09-28 Thread Martin P. Hellwig
Nash wrote: I think normal market rules will apply to Pakistan too, if your desired trade has not the quantity you wish, the price per item should get higher. Net result should be that more quantity will be available due to increased interest. -- MPH http://blog.dcuktec.com 'If consumed, bes

On screen keyboard application

2009-09-28 Thread azrael
Has anyone done already an on screen keyboard applicatioin like the native windows one. I am supossed to make one for a tuchscreen project for my dad's business. It's not a problem about the gui. I guess I will use wx but if I have to use something different it will be no problem. My problem is h

Re: Bash shell to Python shell?

2009-09-28 Thread garabik-news-2005-05
Chris Rebert wrote: > On Sun, Sep 27, 2009 at 8:13 PM, edwithad wrote: >> I am sure you have not read a question this basic in some time, but I am >> curious. Using Linux I open a terminal window and type: python. >> >> Does Bash Shell go away and to become a Python Shell, or is it still a Bash >

Re: UnboundLocalError - (code is short & simple)

2009-09-28 Thread Bruno Desthuilliers
Chris Rebert a écrit : On Sun, Sep 27, 2009 at 8:53 PM, pylearner wrote: --- Traceback (most recent call last): File "", line 1, in toss_winner() File "C:/Python26/toss_winner.py", line 7, in toss_winner coin_toss = coin

Re: variable scope

2009-09-28 Thread Bruno Desthuilliers
Joel Juvenal Rivera Rivera a écrit : Yeah i forgot the self an try the code then i see an error that it was not defines _uno__a so that's where i define the global and see that behavior. (snip) Joel Juvenal Rivera Rivera wrote: Hi i was playing around with my code the i realize of this #

Re: Most "active" coroutine library project?

2009-09-28 Thread Hendrik van Rooyen
On Saturday, 26 September 2009 16:55:30 Grant Edwards wrote: > On 2009-09-26, Dave Angel wrote: > > Actually even 64k looked pretty good, compared to the 1.5k of > > RAM and 2k of PROM for one of my projects, a navigation system > > for shipboard use. > > I've worked on projects as recently as the

Re: variable scope

2009-09-28 Thread Mark Dickinson
On Sep 28, 9:37 am, Bruno Desthuilliers wrote: > Joel Juvenal Rivera Rivera a écrit : > > > > > Yeah i forgot the self an try the code then i see > > an error that it was not defines _uno__a so that's > > where i define the global and see that behavior. > > (snip) > >> Joel Juvenal Rivera Rivera w

Re: Business issues regarding adapting Python

2009-09-28 Thread Vladimir Ignatov
Ha-ha-ha (sorry, can't resist). Here is at Moscow/Russia I have had a tought time finding a Python-related programming job. Positions both very rare (comparing with Java/C++ - maybe 1/100) and not pays well. And about 99% of them are web+Django. -- http://mail.python.org/mailman/listinfo/python-l

epydoc xml output?

2009-09-28 Thread Ole Streicher
Hi, I am using epydoc for my code documentation and I am curious whether there exist a possibility to produce the output in xml format. Reason for that is that I want to convert it to WordML and get it into our private documentation system. Unfortunately, the documentation does not mention xml,

Passing tuples of tuples to sqlite

2009-09-28 Thread xera121
Hi I have tuples in the format shown below: (u('2','3','4'),u('5','6','7')u('20','21','22')) but they are not being accepted into sqlite - due I think to the excessive quote marks which are confusing the issue when converting to a string to send it to sqlite. Can someone advise me on how

Want to call a method only once for unittest.TestCase--but not sure how?

2009-09-28 Thread Oltmans
Hello fellow python hackers, I'm not an expert when it comes to Python and I'm totally stuck in a situation. All of our unit tests are written using built-in 'unittest' module. We've a requirement where we want to run a method only once for our unit tests. Some background: all of our tests are sub

Re: very weird python bug..

2009-09-28 Thread Sampsa Riikonen
On Thursday 24 September 2009 02:01:52 pm Christian Heimes wrote: > Sampsa Riikonen wrote: > > => If I start the program in directory "paska2", everythings OK, but if > > the directory name happens to be "python", the importation of the modules > > goes nuts! > > What's inside the python/ subdirect

Re: Business issues regarding adapting Python

2009-09-28 Thread Jean-Michel Pichavant
Nash wrote: Hello everyone, I'm a big time python fan and it has helped me write code fast and push it out quickly. We have a medium sized telecom product written 90% in Python and 10% in Java. The problem is, in the place where we work (Pakistan), we can't find Python developers. I asked HR to

Re: python profiling for a XML parser program

2009-09-28 Thread Stefan Behnel
MacRules wrote: > I have a python program doing XML data prasing and write the result to 2 > data files; which will be loaded to MySQL. > [...] > Is there a python profiler just like for C program? > And tell me which functions or modules take a long time. In case you want to do this because you n

Re: SQLObject 0.11.1

2009-09-28 Thread Stefan Behnel
Hi, Oleg Broytmann wrote: > I'm pleased to announce version 0.11.1, a minor bugfix release of 0.11 branch > of SQLObject. Have you considered making announcements about (minor) releases on the dedicated Python announce list? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml and xmlsec

2009-09-28 Thread Stefan Behnel
Roland Hedberg wrote: > Anyone know if it is possible to use xmlsec together with lxml ? I remember reading on the lxml mailing list that someone uses both together. You might want to ask over there. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing tuples of tuples to sqlite

2009-09-28 Thread Tim Chase
I have tuples in the format shown below: (u('2','3','4'),u('5','6','7')u('20','21','22')) Um, this is not valid Python which might explain the errors you're getting. Are you sure you don't mean to write: ((u'2', u'3', u'4'), (u'5', u'6', u'7')...) because "u" prefixing a tuple is

Re: Want to call a method only once for unittest.TestCase--but not sure how?

2009-09-28 Thread Francesco Bochicchio
On Sep 28, 12:45 pm, Oltmans wrote: > Hello fellow python hackers, > > I'm not an expert when it comes to Python and I'm totally stuck in a > situation. All of our unit tests are written using built-in 'unittest' > module. We've a requirement where we want to run a method only once > for our unit

Re: UnboundLocalError - code is short & simple

2009-09-28 Thread Francesco Bochicchio
On Sep 28, 6:07 am, pylearner wrote: > System Specs: > > Python version = 2.6.1 > IDLE > Computer = Win-XP, SP2 (current with all windows updates) > > ---­- > > Greetings: > > I have written code for two things:  1

Re: Passing tuples of tuples to sqlite

2009-09-28 Thread lolmc
On 28 Sep, 11:35, xera121 wrote: > Hi > I have tuples in the format shown below: > > (u('2','3','4'),u('5','6','7')u('20','21','22')) > > but they are not being accepted into sqlite - due I think to the > excessive quote marks which are confusing the issue when converting to > a string to

Re: Why the file mode of .pyc files has x?

2009-09-28 Thread Steven D'Aprano
On Mon, 28 Sep 2009 17:01:40 +1000, Cameron Simpson wrote: > On 26Sep2009 10:24, Peng Yu wrote: | > > [st...@sylar test]$ ls -l > | > total 16 > | > -rw-rw-r-- 1 steve steve  6 2009-09-26 23:06 test.py | > -rw-rw-r-- > 1 steve steve 94 2009-09-26 23:08 test.pyc | > > | > Have you checked the umas

Re: llvm vs. parrot

2009-09-28 Thread Paul Watson
On Sun, 2009-04-12 at 06:18 -0700, Fuzzyman wrote: > On Apr 11, 12:16 am, Paul Watson wrote: > > Is Parrot out of favor these days? It appears that Google is going to > > use llvm. > > > > http://code.google.com/p/unladen-swallow/ > > Has Parrot ever been in favour? > > Actually they're quite d

Re: nested structure with "internal references"

2009-09-28 Thread J Kenneth King
Hendrik van Rooyen writes: > On Friday, 25 September 2009 19:11:06 Torsten Mohr wrote: > >> I'd like to use a nested structure in memory that consists >> of dict()s and list()s, list entries can be dict()s, other list()s, >> dict entries can be list()s or other dict()s. >> >> The lists and dicts

Re: [Image-SIG] Some issue with easy_install and PIL/Imaging

2009-09-28 Thread Fredrik Lundh
On Fri, Sep 11, 2009 at 3:49 PM, Chris Withers wrote: > Klein Stéphane wrote: >> >> Resume : >> 1. first question : why PIL package in "pypi" don't work ? > > Because Fred Lundh have his package distributions unfortunate names that > setuptools doesn't like... It used to support this, but no long

Re: Re: Twisted PB: returning result as soon as ready

2009-09-28 Thread exarkun
On 06:06 am, jacopo.pe...@gmail.com wrote: Jean-Paul, thanks a lot for your patient. I have read most of a the 1CThe Twisted Documentation 1D which I think is very good for Deferred and ok for PB but it is really lacking on the Reactor. In my case it looks like this is key to achieve what I ha

Re: Detecting changes to a dict

2009-09-28 Thread Scott David Daniels
Steven D'Aprano wrote: I'm pretty sure the answer to this is No, but I thought I'd ask just in case... Is there a fast way to see that a dict has been modified? ... Of course I can subclass dict to do this, but if there's an existing way, that would be better. def mutating(method): def

Re: Want to call a method only once for unittest.TestCase--but not sure how?

2009-09-28 Thread Scott David Daniels
Oltmans wrote: ... All of our unit tests are written using built-in 'unittest' module. We've a requirement where we want to run a method only once for our unit tests > So I'm completely stumped as to how to create a method that will only > be called only once for Calculator class. Can you pl

GetPaid module that supports "deferred" payments?

2009-09-28 Thread Phillip B Oldham
Are any of the GetPaid modules able to handle "deferred" payments? As in, the money to be taken is placed "on hold" in the customer's account and can be "released" to the vendor at a later date. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing tuples of tuples to sqlite

2009-09-28 Thread lolmc
On 28 Sep, 13:52, lolmc wrote: > On 28 Sep, 11:35, xera121 wrote: > > > Hi > > I have tuples in the format shown below: > > > (u('2','3','4'),u('5','6','7')u('20','21','22')) > > > but they are not being accepted into sqlite - due I think to the > > excessive quote marks which are confusi

create a class instance from C API?

2009-09-28 Thread lallous
Hello How to programmatically create a class instance of a given Python class? For example to create a new list there is the PyObject *PyList_New() but suppose the user already defined a class: class X: pass How to create an instance of it from my C extension module? Regards, Elias -- ht

Re: UnboundLocalError - (code is short & simple)

2009-09-28 Thread Chris Kaynor
On Sun, Sep 27, 2009 at 10:39 PM, New User wrote: > Hi Chris, > > Thank you for the reply and info! > > Re: "from coin_toss import coin_toss" > > My understanding is that this line makes the coin_toss() function in the > coin_toss.py file available to the toss_winner() function. Is that what >

Re: [off-topic] Pessimal (was: Detecting changes to a dict)

2009-09-28 Thread geremy condra
On Mon, Sep 28, 2009 at 9:53 AM, John Posner wrote: > > If you can enumerate the language of possible inputs you could >> generate a unique binary representation. Against a language of size >> l that would only take you O(l*n) to build the repr for a dict >> and for certain repr sizes the compari

Re: create a class instance from C API?

2009-09-28 Thread Carl Banks
On Sep 28, 8:19 am, "lallous" wrote: > Hello > > How to programmatically create a class instance of a given Python class? > > For example to create a new list there is the PyObject *PyList_New() but > suppose the user already defined a class: > > class X: pass > > How to create an instance of it f

Re: [off-topic] Pessimal (was: Detecting changes to a dict)

2009-09-28 Thread geremy condra
Aaagh! Did it without thinking. Should be O(S*N) and O(S*2N). On Sep 28, 2009 12:09 PM, "geremy condra" wrote: On Mon, Sep 28, 2009 at 9:53 AM, John Posner wrote: > > >> If you can enumera... 1) I honestly wouldn't know, seeing as how I wasn't alive ;). 2) After a brief tube hunt, I found tha

multiprocessing, SyncManager, dict() of Locks possible?

2009-09-28 Thread rooster 808
I'm trying to work out a multiple readers, one writer scenerio with a bunch of objects. Basically "foo" objects are shared across processes. Each foo object has a .lock variable, which holds a Mutex. In creation, I'd like to call the SyncManager, get the dict() object which hold object_ids->lock ma

Using String for new List name

2009-09-28 Thread Scott
I am new to Python but I have studied hard and written a fairly big (to me) script/program. I have solved all of my problems by Googling but this one has got me stumped. I want to check a string for a substring and if it exists I want to create a new, empty list using that substring as the name of

Re: Using String for new List name

2009-09-28 Thread Olof Bjarnason
2009/9/28 Scott : > I am new to Python but I have studied hard and written a fairly big > (to me) script/program. I have solved all of my problems by Googling > but this one has got me stumped. > > I want to check a string for a substring and if it exists I want to > create a new, empty list using

Pool module -- does map pre-assign tasks to processes?

2009-09-28 Thread Luca
I would like to use the Pool module, but my tasks take sometimes unpredictably different time to complete. The simplest way to write the code would be to put all task descriptions in an array, then call p = Pool(8) p.map(f, a) But I don't want to preassign process 0 with elements a[0], a[8], a [

Re: Using String for new List name

2009-09-28 Thread Duncan Booth
Scott wrote: > for X in open("file1"): > Do a test. > If true: > Y = re.split(" ", X) > Z = Y[0] # This is a string, maybe it is "Line42" > Z = [] # This doesn't work, I want a new, empty > list created called Line42 not Z. > > Is there any w

Re: Using String for new List name

2009-09-28 Thread Ethan Furman
Scott wrote: I am new to Python but I have studied hard and written a fairly big (to me) script/program. I have solved all of my problems by Googling but this one has got me stumped. I want to check a string for a substring and if it exists I want to create a new, empty list using that substring

Re: Using String for new List name

2009-09-28 Thread Scott
Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append("new stuff"). (or [var] if I'm looping through the dict) This is cool and should do the trick! -Scott Freemire disclosure - Ok, I'm new to *any* language. I've been teaching myself for about 3

Re: Using String for new List name

2009-09-28 Thread Olof Bjarnason
2009/9/28 Scott : > Thank you fine folks for getting back with your answers! > > So down the road I do dictname[line42].append("new stuff"). (or [var] > if I'm looping through the dict) > > This is cool and should do the trick! > > -Scott Freemire > disclosure - Ok, I'm new to *any* language. I've

Re: How to run python script in emacs

2009-09-28 Thread Nobody
On Sun, 27 Sep 2009 19:44:07 -0700, devilkin wrote: > and does the python-mode support auto-complete? No. -- http://mail.python.org/mailman/listinfo/python-list

Re: IMGCrush (New Python image optimizing tool)

2009-09-28 Thread kiithsa...@gmail.com
On Sep 5, 4:30 pm, a...@pythoncraft.com (Aahz) wrote: > In article > , > > kiithsa...@gmail.com wrote: > > >Requires ImageMagick and Python (coded in python 2.x, I'm running 2.6 > >but it might run on older python as well) > > Why are you using ImageMagick instead of PIL? > -- > Aahz (a...@python

Re: Using String for new List name

2009-09-28 Thread Ethan Furman
Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append("new stuff"). (or [var] if I'm looping through the dict) This is cool and should do the trick! -Scott Freemire disclosure - Ok, I'm new to *any* language. I've been teaching myse

SQLObject

2009-09-28 Thread ChrisW
I'm new to using SQLObject, and having some problems with getting it to recognise my current MySQL database. I've set up my connection fine, but it won't recognise the names of the columns (presumably because they're not written using the default naming convention?). For example, one of my column

Re: Using String for new List name

2009-09-28 Thread Terry Reedy
Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append("new stuff"). The keys are strings, so dictname['line42'].append("new stuff") or for key in dictname.keys(): ... dictname[key] tjr -- http://mail.python.org/mailman/

Re: Using String for new List name

2009-09-28 Thread Scott
> That should actually be dictname["line42"].append("new stuff").  Notice > the quotes around line42. > > Good luck!  Python is a fine language, I hope you like it. > > ~Ethan~ Doh. I sent it before my type, fail, fix cycle had taken place. Got it. Thanks again all! -- http://mail.python.org/mai

Re: Using String for new List name

2009-09-28 Thread Dave Angel
Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append("new stuff"). (or [var] if I'm looping through the dict) Nope, you still haven't gotten it. Of course, I really don't know where you're going wrong, since you didn't use the

Re: Some issue with easy_install and PIL/Imaging

2009-09-28 Thread Klein Stéphane
Fredrik Lundh a écrit : On Fri, Sep 11, 2009 at 3:49 PM, Chris Withers wrote: Klein Stéphane wrote: Resume : 1. first question : why PIL package in "pypi" don't work ? Because Fred Lundh have his package distributions unfortunate names that setuptools doesn't like... It used to support this

Re: UnboundLocalError - (code is short & simple)

2009-09-28 Thread New User
Thank you for the elaboration, Chris!  I don't have the background to follow your example code.  However, between your summary of the code, and the code examples themselves, I have enough info to get a glimpse of what you're explaining.  Also, I can use the info as a foundation for further study

Re: Most "active" coroutine library project?

2009-09-28 Thread Arlo Belshee
On Sep 25, 2:07 pm, Grant Edwards wrote: > On 2009-09-25, Jason Tackaberry wrote: > > > And I maintain that requiring yield doesn't make it any less a > > coroutine. > > > Maybe we can call this an aesthetic difference of opinion? > > Certainly. > > You've a very valid point that "transparent" ca

Re: Repeated output when logging exceptions

2009-09-28 Thread John Gordon
In <6bce12c3-f2d9-450c-89ee-afa4f21d5...@h30g2000vbr.googlegroups.com> Vinay Sajip writes: > The logging package allows you to add tracebacks to your logs by using > the exception() method, which logs an ERROR with a traceback and is > specifically intended for use from within exception handlers

Re: How to run python script in emacs

2009-09-28 Thread Brian
I do all my python coding in emacs. It's awesome. Here's how I do it: *Create windmove bindings* This is important - it maps *Meta-i,j,k,l* to move your window focus up, left, down, right. It's used in conjunction with *C-x 3* (split window vertically) and *C-x 2* (split window horizontally). So t

Re: UnboundLocalError - (code is short & simple)

2009-09-28 Thread New User
Thanks for the light you shed on the "namespace" issue, and for the additional info and code example.  I'll be studying more about the info you shared.  Also, I tried out your code example, to get firsthand experience with it. Cheers, Martin --- On Mon, 9/28/09, Bruno Desthuilliers wrote: F

Re: Multidimensional arrays/lists

2009-09-28 Thread Ethan Furman
Simon Forman wrote: On Sun, Sep 27, 2009 at 12:40 PM, Someone Something wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O.

Python win32 ActiveX scripting input box question

2009-09-28 Thread Kevin Young
I am trying to assign the user input into a variable. I am using Python as an ActiveX scripting language in a host that allows for activex scripting. I am able to create an input box with the following >> import win32ui >> from pywin.mfc.dialog import Dialog >> d = Dialog(win32ui.IDD_SIMPLE_INPUT

Re: Multidimensional arrays/lists

2009-09-28 Thread Simon Forman
On Mon, Sep 28, 2009 at 3:27 PM, Ethan Furman wrote: > Simon Forman wrote: >> >> On Sun, Sep 27, 2009 at 12:40 PM, Someone Something >> wrote: >> >>> I'm trying to write a little tic-tac-toe program I need a array/list such >>> that I can represent the tic tac toe board with an x axis and y axis

Re: Repeated output when logging exceptions

2009-09-28 Thread Simon Forman
On Mon, Sep 28, 2009 at 4:38 PM, John Gordon wrote: > In <6bce12c3-f2d9-450c-89ee-afa4f21d5...@h30g2000vbr.googlegroups.com> Vinay > Sajip writes: > >> The logging package allows you to add tracebacks to your logs by using >> the exception() method, which logs an ERROR with a traceback and is >>

Re: SQLObject

2009-09-28 Thread Daniel Fetchinson
> I'm new to using SQLObject, and having some problems with getting it > to recognise my current MySQL database. > > I've set up my connection fine, but it won't recognise the names of > the columns (presumably because they're not written using the default > naming convention?). For example, one o

is there some error crashing reporting

2009-09-28 Thread Stef Mientki
like MadExcept for Delphi http://www.madshi.net/madExceptDescription.htm which catches any error, send an email with the error report and complete system analysis to the author, and continues the program (if possible) thanks, Stef -- http://mail.python.org/mailman/listinfo/python-list

Re: Using String for new List name

2009-09-28 Thread Scott
On Sep 28, 2:00 pm, Dave Angel wrote: > Scott wrote: > > Thank you fine folks for getting back with your answers! > > > So down the road I do dictname[line42].append("new stuff"). (or [var] > > if I'm looping through the dict) > > Nope, you still haven't gotten it.  Of course, I really don't know

module path?

2009-09-28 Thread akonsu
hello, is there a way to determine the file location of a loaded module? assuming it is not built in. import settings print settings produces: i would like to get to this path somehow other than by parsing the string representation of the module. is there a property on types.ModuleType? i coul

Re: Business issues regarding adapting Python

2009-09-28 Thread Raymond Hettinger
On Sep 27, 12:13 am, Nash wrote: > Hello everyone, > > I'm a big time python fan and it has helped me write code fast and > push it out quickly. We have a medium sized telecom product written > 90% in Python and 10% in Java. The problem is, in the place where we > work (Pakistan), we can't find Py

Re: module path?

2009-09-28 Thread Steven D'Aprano
On Mon, 28 Sep 2009 16:41:36 -0700, akonsu wrote: > hello, > > is there a way to determine the file location of a loaded module? > assuming it is not built in. > > import settings > print settings > > produces: > > i would like to get to this path somehow other than by parsing the > string re

Re: Business issues regarding adapting Python

2009-09-28 Thread Martin P. Hellwig
Vladimir Ignatov wrote: Ha-ha-ha (sorry, can't resist). Here is at Moscow/Russia I have had a tought time finding a Python-related programming job. Positions both very rare (comparing with Java/C++ - maybe 1/100) and not pays well. And about 99% of them are web+Django. To who/what are you reply

Re: module path?

2009-09-28 Thread akonsu
On Sep 28, 7:51 pm, Steven D'Aprano wrote: > On Mon, 28 Sep 2009 16:41:36 -0700, akonsu wrote: > > hello, > > > is there a way to determine the file location of a loaded module? > > assuming it is not built in. > > > import settings > > print settings > > > produces: > > > i would like to get to

Re: module path?

2009-09-28 Thread Dave Angel
akonsu wrote: hello, is there a way to determine the file location of a loaded module? assuming it is not built in. import settings print settings produces: i would like to get to this path somehow other than by parsing the string representation of the module. is there a property on types.Mo

Global array in python

2009-09-28 Thread Rudolf
How can i declare a global array in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Global array in python

2009-09-28 Thread Chris Rebert
On Mon, Sep 28, 2009 at 5:48 PM, Rudolf wrote: > How can i declare a global array in python? Python has no concept of declarations. And it doesn't have arrays, it has dynamically-resizing lists. Some examples: one_empty_list = [] a_list_of 5 zeroes = [0]*5 Might I recommend you read the Pytho

Re: Why the file mode of .pyc files has x?

2009-09-28 Thread Peng Yu
On Mon, Sep 28, 2009 at 12:43 AM, greg wrote: > Peng Yu wrote: >> >> -rw--- 1 pengy lilab  29 2009-09-26 10:10:45 main.py >> -rwx-- 1 pengy lilab 106 2009-09-26 10:19:17 test.py >> -rwx-- 1 pengy lilab 339 2009-09-26 10:20:39 test.pyc > > Doesn't happen for me with 2.5 on Darwin. > > W

Re: Why the file mode of .pyc files has x?

2009-09-28 Thread Peng Yu
On Mon, Sep 28, 2009 at 8:22 AM, Steven D'Aprano wrote: > On Mon, 28 Sep 2009 17:01:40 +1000, Cameron Simpson wrote: > >> On 26Sep2009 10:24, Peng Yu wrote: | > >> [st...@sylar test]$ ls -l >> | > total 16 >> | > -rw-rw-r-- 1 steve steve  6 2009-09-26 23:06 test.py | > -rw-rw-r-- >> 1 steve steve

Re: How to refer to class name and function name in a python program?

2009-09-28 Thread Peng Yu
On Sun, Sep 20, 2009 at 12:43 PM, Benjamin Kaplan wrote: > On Sun, Sep 20, 2009 at 12:43 PM, Peng Yu wrote: >> On Sun, Sep 20, 2009 at 11:32 AM, Vijayendra Bapte >> wrote: >>> On Sep 20, 8:38 pm, Peng Yu wrote: Hi, I have the following code. I want to change the function body of

Re: Global array in python

2009-09-28 Thread rantingrick
On Sep 28, 8:04 pm, Chris Rebert wrote: > On Mon, Sep 28, 2009 at 5:48 PM, Rudolf wrote: > > How can i declare a global array in python? > > Python has no concept of declarations. > And it doesn't have arrays, it has dynamically-resizing lists. What version are you using, i must have py4000 alph

Re: can i use the browser to show the result of python

2009-09-28 Thread Hacken
On Sep 27, 12:24 pm, Dave Angel wrote: > Hacken wrote: > > On Sep 25, 6:27 pm, Dave Angel wrote: > > >> Hacken wrote: > > >>> I have write some python script > > >>> i want to use browser(IE or FF) to call it, an show the returns! > > >>> how to? > > >> You don't say much about your environment,

How to jump out of nested 'for'-loops?

2009-09-28 Thread Peng Yu
Hi, I want some command to jump out of nested loop. I'm wondering what is the most convenient way to do so in python. for i in range(10): print "i = ", i for j in range(10): if i*10 + j == 50: print i*10 + j break # I want to jump out of the loops. Regards, Peng -- http://ma

"Pipeline" Generator presentation - where?

2009-09-28 Thread Sean DiZazzo
I remember reading (a few times) a presentation about using generators to create "pipelines" The idea was to create very specific and small generator functions, and then combine them together to get larger results. The example used was to parse log files contained in gzipped log files among other

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread Zero Piraeus
: > I want some command to jump out of nested loop. I'm wondering what is > the most convenient way to do so in python. http://www.google.com/search?q=python+nested+break -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread r
On Sep 28, 10:09 pm, Peng Yu wrote: > Hi, > > I want some command to jump out of nested loop. I'm wondering what is > the most convenient way to do so in python. > > for i in range(10): >   print "i = ", i >   for j in range(10): >     if i*10 + j == 50: >       print i*10 + j >       break # I wa

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread Sean DiZazzo
On Sep 28, 8:09 pm, Peng Yu wrote: > Hi, > > I want some command to jump out of nested loop. I'm wondering what is > the most convenient way to do so in python. > > for i in range(10): >   print "i = ", i >   for j in range(10): >     if i*10 + j == 50: >       print i*10 + j >       break # I wan

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread D'Arcy J.M. Cain
On Mon, 28 Sep 2009 22:09:37 -0500 Peng Yu wrote: > I want some command to jump out of nested loop. I'm wondering what is > the most convenient way to do so in python. Forget about jumping out of a loop. Put your loop into a function and simply return. Much cleaner and clearer. > for i in range

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

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread alex23
Peng Yu wrote: > I want some command to jump out of nested loop. I'm wondering what is > the most convenient way to do so in python. I'm sure I'm wasting my breath by saying this, but would it hurt you to actually check the list before posting? You're not the only person to ever have used Python,

Re: "Pipeline" Generator presentation - where?

2009-09-28 Thread Gary Herron
Sean DiZazzo wrote: I remember reading (a few times) a presentation about using generators to create "pipelines" The idea was to create very specific and small generator functions, and then combine them together to get larger results. The example used was to parse log files contained in gzipped

Re: "Pipeline" Generator presentation - where?

2009-09-28 Thread alex23
Sean DiZazzo wrote: > I remember reading (a few times) a presentation about using generators > to create "pipelines"  The idea was to create very specific and small > generator functions, and then combine them together to get larger > results.  The example used was to parse log files contained in

Re: "Pipeline" Generator presentation - where?

2009-09-28 Thread Sean DiZazzo
On Sep 28, 9:12 pm, alex23 wrote: > Sean DiZazzo wrote: > > I remember reading (a few times) a presentation about using generators > > to create "pipelines"  The idea was to create very specific and small > > generator functions, and then combine them together to get larger > > results.  The exam

Re: Global array in python

2009-09-28 Thread Olof Bjarnason
2009/9/29 rantingrick : > On Sep 28, 8:04 pm, Chris Rebert wrote: >> On Mon, Sep 28, 2009 at 5:48 PM, Rudolf wrote: >> > How can i declare a global array in python? >> >> Python has no concept of declarations. >> And it doesn't have arrays, it has dynamically-resizing lists. > > What version are

Re: Global array in python

2009-09-28 Thread Chris Rebert
On Mon, Sep 28, 2009 at 6:55 PM, rantingrick wrote: > On Sep 28, 8:04 pm, Chris Rebert wrote: >> On Mon, Sep 28, 2009 at 5:48 PM, Rudolf wrote: >> > How can i declare a global array in python? >> >> Python has no concept of declarations. >> And it doesn't have arrays, it has dynamically-resizing

Re: Why the file mode of .pyc files has x?

2009-09-28 Thread greg
Peng Yu wrote: What python/OS are you using? python 2.6.2 and CentOS Just tried 2.6 on Darwin, and it does happen. So looks like 2.6 has been changed to inherit the permission bits from the .py. Makes sense, except that the x bits should really be turned off. -- Greg -- http://mail.python.o

os.listdir unwanted behaviour

2009-09-28 Thread Chris Adamson
Hello, I am writing code that cycles through files in a directory and for each file it writes out another file with info in it. It appears that as I am iterating through the list returned by os.listdir it is being updated with the new files that are being added to the directory. This occurs e

Re: os.listdir unwanted behaviour

2009-09-28 Thread Chris Rebert
On Mon, Sep 28, 2009 at 11:03 PM, Chris Adamson wrote: > Hello, > > I am writing code that cycles through files in a directory and for each file > it writes out another file with info in it. It appears that as I am > iterating through the list returned by os.listdir it is being updated with > the

Re: Repeated output when logging exceptions

2009-09-28 Thread Vinay Sajip
On Sep 28, 9:38 pm, John Gordon wrote: > > If I didn't do all that in a class, where would I do it? > You could, for example, use the basicConfig() function to do it all for you. import logging logging.basicConfig(filename='/path/to/my/log',level=logging.DEBUG) logging.debug('This message shoul