Re: Python 2.7 and cmd on Windows 7 64 (files lost)

2011-06-23 Thread Tim Golden
On 23/06/2011 09:08, Thorsten Kampe wrote: * Tim Golden (Thu, 23 Jun 2011 08:31:26 +0100) Certain commands, including "dir" and "copy" are not executables in their own right, but merely subcommands of cmd.exe. Right, "internal commands". You've got two o

Re: User Authentication

2011-06-23 Thread Tim Golden
On 23/06/2011 16:07, Anurag wrote: My application is a web based application for both windows and Linux. The web part is developed using Django. So if Python does not support it then any support for local sytem account authentication in Django? I am looking for a common library for both Linux an

Re: windows 7 create directory with read write execute permission for everybody

2011-06-27 Thread Tim Golden
On 26/06/2011 21:57, Gelonida wrote: Hi, What do I have to do under python windows to create a directory with all permissions, such, that new files / directories created below will inherit the permissions. The reason I am asking is, that I'd like to create a directory structure where multiple

Re: Enhanced dir() function

2011-07-01 Thread Tim Chase
.endswith('__'))] # constants [s for s in dir(foo) if s.isupper()] # keywording [s for s in dir(foo) if 'bar' in s.lower()] Anyways, even if it just includes a brief blurb about "and this is how you get it automatically in every Python session" (or

Re: How to get a dateiled process information on windows?

2011-07-01 Thread Tim Golden
On 01/07/2011 21:06, Leandro Ferreira wrote: I need to write an application that monitors the memory consumption of a process, there is some library that facilitates this work? I searched on google found nothing more interesting. Have a look at WMI TJG -- http://mail.python.org/mailman/listinf

Re: Why won't this decorator work?

2011-07-02 Thread Tim Chase
On 07/02/2011 01:08 PM, John Salerno wrote: On Jul 2, 12:33 pm, MRAB wrote: roll_die = move(roll_die) You should be defining a function (a callable) and then passing it to a decorator which returns a callable. But why does the documentation say "The return value of the decorator need n

Re: poll of filesystem

2011-07-02 Thread Tim Roberts
the kernel. The data is ALWAYS available. If you want the data once a second, just do it the easy way: import time while True: print open('/proc/loadavg').read() time.sleep(1) -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: The end to all language wars and the great unity API to come!

2011-07-02 Thread Tim Chase
On 07/02/2011 06:46 PM, rantingrick wrote: On Jul 2, 6:38 pm, Chris Angelico wrote: It saddens me when i see API's that don't include at least three language choices. No *one* language is going to please the masses. C or C++ bindings will cover most languages. This is pretty much the entire

Testing if a global is defined in a module

2011-07-04 Thread Tim Johnson
ned in the module is passed as an argument to inspect.getmodule, the values returned is something like "" Likewise for functions defined in the module. ** But ** when global variables such as strings, booleans, integers are passed as an argument to getmodule, the value returned is `None&#x

Re: Testing if a global is defined in a module

2011-07-04 Thread Tim Johnson
* rantingrick [110704 12:00]: > On Jul 4, 1:11 pm, Tim Johnson wrote: > > Well if you follow the python style guide (and most accepted styles > for global notation) then it's a trial exercise. You don't even have > to import anything!!! :) > > >>&g

Re: Testing if a global is defined in a module

2011-07-04 Thread Tim Johnson
hat's bad practice and should > be refactored anyway. I'm completely new to the `ast' module, so I will have to research that one. Thanks for the tip -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing if a global is defined in a module

2011-07-04 Thread Tim Johnson
* rantingrick [110704 13:47]: > On Jul 4, 3:30 pm, Tim Johnson wrote: > > > >   Thanks for the reply: *but* > >   dir() will also show globals from other modules imported > >   by the target module. So I would need a way to distinguish between > >   those importe

Re: Testing if a global is defined in a module

2011-07-04 Thread Tim Johnson
ces that aren't differences is surely the wrong > way to do it. See my last post... -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing if a global is defined in a module

2011-07-04 Thread Tim Johnson
* Steven D'Aprano [110704 15:48]: > Tim Johnson wrote: > > >> It seems to me that your approach here is unnecessarily complex and > >> fragile. I don't know what problem you are trying to solve, but trying to > >> solve it by intraspecting differences

Re: Testing if a global is defined in a module

2011-07-04 Thread Tim Johnson
* Chris Angelico [110704 16:19]: > On Tue, Jul 5, 2011 at 10:01 AM, Tim Johnson wrote: > >  Steven, I'm building a documentation system. I have my own MVC framework > >  and the goal is to have a documentation module for each project. > > > > Is there a reason

Re: Testing if a global is defined in a module

2011-07-05 Thread Tim Johnson
nce of strings which are the exported names. Otherwise, the > exported names are taken to be all the names in the module dict that > don't begin with an underscore. :) Oh here we go again. Another python feature I didn't know about or have forgotten. Thanks very much for that. G

Re: The end to all language wars and the great unity API to come!

2011-07-05 Thread Tim Chase
On 07/05/2011 05:35 PM, rantingrick wrote: One thing is for sure, i always get a giggle from your self defeating posts. You're the best enemy a person could have. Thank you. *bows* Every time I see a rantingrick post, it's like watching the Black Knight scene from the Holy Grail yet again. Yo

Re: Not able to store data to dictionary because of memory limitation

2011-07-06 Thread Tim Chase
On 07/06/2011 02:49 AM, Rama Rao Polneni wrote: After storing 1.99 GB data in to the dictionary, python stopped to store the remaining data in to dictionary. Is there any alternate solution to resolve this issue. Like splitting the dictionaries or writing the data to hard disk instead of writing

Re: Implicit initialization is EVIL!

2011-07-06 Thread Tim Chase
On 07/06/2011 11:24 AM, Chris Angelico wrote: On Thu, Jul 7, 2011 at 1:10 AM, rantingrick wrote: Wow nice corner case. Can you come up with at least five of them though? You and I both know that the vast majority of GUI's require visible windows. Five corner cases. Okay. One is xkill; if I ca

Re: Serial & reset of the device

2011-07-08 Thread Tim Roberts
#x27;m not sure what that means. The RS-232 standard does not have the concept of "reset". What is it that triggers a device reset? -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Serial & reset of the device

2011-07-08 Thread Tim Chase
On 07/08/2011 02:45 AM, Tim Roberts wrote: yorick wrote: I'm trying to access a hardware board of my company through a serial connection using a Python script and the pyserial module. The board to which I'm trying to connect works correctly with serial as some other guys did some T

Function docstring as a local variable

2011-07-10 Thread Tim Johnson
Consider the following: ## code def test(): """This is my docstring""" print(??) ## can I print the docstring above? ## /code It possible for a function to print it's own docstring? thanks (pointers to docs could be sufficient) -- Tim tim at johnso

Re: Function docstring as a local variable

2011-07-10 Thread Tim Johnson
* Andrew Berg [110710 09:59]: > -BEGIN PGP SIGNED MESSAGE- > Hash: RIPEMD160 > > On 2011.07.10 12:41 PM, Tim Johnson wrote: > > It possible for a function to print it's own docstring? > >>> def test(): > ... """Hi there.&qu

Re: Function docstring as a local variable

2011-07-10 Thread Tim Johnson
; print test.__doc__ > > test() Works for me. Works for the application I'm after. thanks Here's a related question: I can get the docstring for an imported module: >>> import tmpl as foo >>> print(foo.__doc__) Python templating features Author -

Re: Function docstring as a local variable

2011-07-10 Thread Tim Chase
On 07/10/2011 05:50 PM, Tim Johnson wrote: * pyt...@bdurham.com [110710 14:17]: def test(): """This is my doc string""" print test.__doc__ test() Works for me. Works for the application I'm after. thanks Here's a related questio

Re: Function docstring as a local variable

2011-07-10 Thread Tim Johnson
* Carl Banks [110710 15:18]: > On Sunday, July 10, 2011 3:50:18 PM UTC-7, Tim Johnson wrote: > > Here's a related question: > > I can get the docstring for an imported module: > > >>> import tmpl as foo > > >>> print(foo.__doc__) > &g

Re: Function docstring as a local variable

2011-07-10 Thread Tim Johnson
esults. > Look in the "underscore" section of the documentation index: > http://docs.python.org/genindex-_.html And that is what I was looking for. thanks -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes: point to buffer in structure

2011-07-10 Thread Tim Roberts
aximumLength gives the allocated size of the buffer. Length gives the length of the string currently held in the buffer. It can be less than the maximum length, and the buffer does NOT necessarily contain a zero-terminator. UNICODE_STRING and ANSI_STRING are used in kernel programming to avoid the

Re: "Python Wizard," with apologies to The Who

2011-07-12 Thread Tim Daneliuk
it bring you as much joy as it brought me! > You realize that you must now reprise this with, "I'm your wicked Uncle Guido" ... right? -- ---- Tim Daneliuk tun...@tundraware.com -- http://mail.python.org/mailman/listinfo/python-list

Re: "Python Wizard," with apologies to The Who

2011-07-12 Thread Tim Daneliuk
On 7/12/2011 12:08 PM, Tim Daneliuk said this: > On 7/12/2011 11:40 AM, John Keisling said this: >> After too much time coding Python scripts and reading Mark Lutz's >> Python books, I was inspired to write the following lyrics. For those >> too young to remember, th

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-13 Thread Tim Chase
On 07/13/2011 06:26 AM, Thorsten Kampe wrote: Source code is (unlike normal text) not read line by line. So you (at least I) don't have to backtrack from line 2 to line 1 because you see them both at the same time. $a You mean there are people who don't use "ed" to write their code? ;-) -tkc .

Re: feeding the troll (was: Tabs -vs- Spaces: Tabs should have won.)

2011-07-16 Thread Tim Chase
On 07/16/2011 11:51 AM, rantingrick wrote: 1) Using only one indention token removes any chance of user error. I'm not sure it "removes any chance of user error"...programmers are an awfully error-prone lot -- especially beginners. Picking one or the other might help reduce friction when lea

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Tim Roberts
but it certainly allowed. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-17 Thread Tim Chase
On 07/16/2011 10:10 PM, Steven D'Aprano wrote: But I've never come across an email client that messes with attachments. Just send your code as an attached .py file and it's all good. However I'm on a couple mailing lists (e.g. lurking on OpenBSD) that strip all attachments... -tkc -- http

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread Tim Chase
4) Tabs remove the need for complicated indention/detention tools. On 07/17/2011 10:15 AM, rantingrick wrote: On Jul 17, 2:32 am, Ian Kelly wrote: This. I used to think that tabs were better, for pretty much the reasons Rick outlined, but I've had enough problems with editors munging my tabs

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-18 Thread Tim Chase
On 07/17/2011 08:01 PM, Steven D'Aprano wrote: Roy Smith wrote: We don't have that problem any more. It truly boggles my mind that we're still churning out people with 80 column minds. I'm willing to entertain arguments about readability of long lines, but the idea that there's something magic

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-18 Thread Tim Roberts
and friends with ts=8 and sw=4 will use 4 spaces, then tab, then tab plus 4 spaces, then two tabs, etc. That's recognizable, but I still convert such a file to all spaces when I find one. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to iterate through two dicts efficiently

2011-07-19 Thread Tim Chase
On 07/19/2011 04:36 AM, J wrote: Someone in a different forum suggested that I use 'binary search' to iterate through the dictionaries I'm not sure what they were smoking...a binary search is useful for finding a thing in a sorted list. It looks like your data is not sorted (strike #1) and i

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread Tim Chase
On 07/19/2011 09:12 PM, sturlamolden wrote: How I would prefer the GUI library to be, if based on "native" widgets: http://xkcd.com/927/ :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: changing thread topics (was: I am fed up with Python GUI toolkits...)

2011-07-20 Thread Tim Chase
On 07/20/2011 08:17 PM, rantingrick wrote: RE: *Ben Finney changes thread subject* Please everyone, do not change the subject of someone's thread because it's considered rude. Thank you. Right...do not change the subject because it's considered rude. Change it because the topic drifted from

Re: [PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-22 Thread Tim Chase
On 07/22/2011 03:26 AM, Lars Gustäbel wrote: On Thu, Jul 21, 2011 at 08:46:05PM -0700, rantingrick wrote: Tarfile is missing the attribute "fp" and instead exposes a boolean "closed". This mismatching API is asinine! Both tarfile and zipfile should behave EXACTLY like file objects What do you

Re: I am fed up with Python GUI toolkits...

2011-07-22 Thread Tim Roberts
tioning. With style sheets, you can get very complete control over the look and feel. This is very similar to what Microsoft has done with Windows Presentation Foundation, except that they are using a more sophisticated XML DTD. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc

Re: I am fed up with Python GUI toolkits...

2011-07-24 Thread Tim Roberts
Gregory Ewing wrote: >Tim Roberts wrote: >> >> I don't think your glibness is justified. There is a legitimate appeal to >> this notion. The fact is that MANY APIs can be completely and adequately >> described by HTML. > >My brain raises a TypeErr

Re: python.org is down?

2011-07-25 Thread Tim Chase
On 07/25/2011 11:45 AM, SigmundV wrote: On Jul 24, 8:43 am, Laszlo Nagy wrote: Can it be a problem on my side? I have tried from several different computers. I cannot even ping it. Whenever a page can't be accessed, although your connection is good, http://www.downforeveryoneorjustme.com/ is

Hostmonster : Installing MySQLdb at a specific location

2011-07-31 Thread Tim Johnson
wnloaded MySQL-python-1.2.3 and am looking at the docs, but so far I haven't found any documentation that tells me how (or if) I may install to anything other than a default path. Any comments are welcome. TIA tim -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebso

Re: Hostmonster : Installing MySQLdb at a specific location

2011-07-31 Thread Tim Johnson
* Tim Johnson [110731 11:01]: > I've using MySQLdb for years, but always on servers where I had > system-wide access. > > I have an account on Hostmonster and would like to do some > development there, but although python2.6 is available, MySQLdb is > not installed. I do

Re: Hostmonster : Installing MySQLdb at a specific location

2011-08-01 Thread Tim Johnson
* Tim Johnson [110731 11:47]: > I don't want to discourage any further input, but I'm looking at > https://my.hostmonster.com/cgi/help/000531?step=000531 > regarding installing django and I think the instructions can be > extrapolated for MySQLdb. I will report what hap

Re: Hardlink sub-directories and files

2011-08-02 Thread Tim Chase
On 08/02/2011 04:32 AM, loial wrote: I am trying to hardlink all files in a directory structure using os.link. Or is there an easier way to hardlink everything in a directory structure?. The requirement is for hard links, not symbolic links While Peter & Thomas gave good answers, also be aware

Re: Require information on python API for Subversion related work

2011-08-02 Thread Tim Golden
On 02/08/2011 14:02, Shambhu Rajak wrote: I need an api that can be used to do following operations on Subversion repository tool: 1.Create branch 2.Check out 3.Check in 4.Merge http://pysvn.tigris.org/ (which is, by the way, the first Google hit for "Python Subversion bindings") TJG -

Re: what is the advantage of Django when comparing with LAMP and J2EE platform?

2011-08-02 Thread Tim Johnson
not java. The definition for LAMP given at http://en.wikipedia.org/wiki/LAMP_(software_bundle) - for what it is worth includes python and defines LAMP as sort of generic (as I read it). Thus django *could* be considered a LAMP bundle, perhaps. -- Tim tim at johnsons-web dot com or akwebs

Re: Syntactic sugar for assignment statements: one value to multiple targets?

2011-08-03 Thread Tim Chase
On 08/03/2011 03:25 AM, Steven D'Aprano wrote: gc wrote: Target lists using comma separation are great, but they don't work very well for this task. What I want is something like a,b,c,d,e = *dict() a, b, c, d, e = [dict() for i in range(5)] Unfortunately there is no way of doing so withou

Re: Syntactic sugar for assignment statements: one value to multiple targets?

2011-08-03 Thread Tim Chase
On 08/03/2011 03:36 AM, Katriel Cohn-Gordon wrote: On Wed, Aug 3, 2011 at 9:25 AM, Steven D'Aprano wrote: a, b, c, d, e = [dict() for i in range(5)] I think this is good code -- if you want five different dicts, then you should call dict five times. Otherwise Python will magically call your ex

Re: PyWhich

2011-08-04 Thread Tim Chase
On 08/04/2011 07:43 AM, Billy Mays wrote: Hey c.l.p., I wrote a little python script that finds the file that a python module came from. Does anyone see anything wrong with this script? #!/usr/bin/python import sys if __name__ == '__main__': if len(sys.argv)> 1: try:

Re: PyWhich

2011-08-04 Thread Tim Chase
On 08/04/2011 07:34 PM, Steven D'Aprano wrote: Billy Mays wrote: #!/usr/bin/python I believe the recommended, platform independent hash-bang line is #!/usr/bin/which python I think you mean #!/usr/bin/env python -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWhich

2011-08-05 Thread Tim Golden
On 05/08/2011 14:51, Steven D'Aprano wrote: Tim Chase wrote: On 08/04/2011 07:34 PM, Steven D'Aprano wrote: Billy Mays wrote: #!/usr/bin/python I believe the recommended, platform independent hash-bang line is #!/usr/bin/which python I think you mean #!/usr/bin/env python

Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk
eas anyone? -- -------- Tim Daneliuk tun...@tundraware.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk
On 8/5/2011 2:05 PM, Irmen de Jong said this: > On 05-08-11 19:53, Tim Daneliuk wrote: >> I have a task where I want to create pretty simple one page visual >> interfaces (Graphical or Text, but it needs to run across Windows, >> Cygwin, Linux,*BSD, OSX ...). These interf

Re: Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk
On 8/5/2011 3:42 PM, Philip Semanchuk wrote: On Aug 5, 2011, at 4:10 PM, Tim Daneliuk wrote: On 8/5/2011 2:05 PM, Irmen de Jong said this: On 05-08-11 19:53, Tim Daneliuk wrote: I have a task where I want to create pretty simple one page visual interfaces (Graphical or Text, but it needs to

Re: Table Driven GUI Definition?

2011-08-05 Thread Tim Daneliuk
On 8/5/2011 5:51 PM, Philip Semanchuk wrote: On Aug 5, 2011, at 6:20 PM, Tim Daneliuk wrote: On 8/5/2011 3:42 PM, Philip Semanchuk wrote: On Aug 5, 2011, at 4:10 PM, Tim Daneliuk wrote: On 8/5/2011 2:05 PM, Irmen de Jong said this: On 05-08-11 19:53, Tim Daneliuk wrote: I have a task

Re: How do I implement two decorators in Python both of which would eventually want to call the calling function

2011-08-06 Thread Tim Chase
On 08/06/2011 02:49 AM, Chris Rebert wrote: On Fri, Aug 5, 2011 at 10:49 PM, Devraj wrote: My question, how do I chain decorators that end up executing the calling method, but ensure that it's only called once. That's how it works normally; decorators stack (and order is therefore important).

Re: how to separate a list into two lists?

2011-08-06 Thread Tim Roberts
= dict(L).values() but that reorders the tuples. They still correspond, but in a different order. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: just for fun: make a class (not its instances) iterable

2011-08-09 Thread Tim Chase
On 08/09/2011 07:11 PM, Terry Reedy wrote: On 8/9/2011 5:43 PM, Gelonida N wrote: Now I wondered whether there is any way to implement a class such, that I can write for val in MyClass: print val And what are the items in a class that you expect that to produce? I can see doing som

multiprocessing timing issue

2011-08-09 Thread Tim Arnold
ocessing before, but never with a Queue like this. Any notes or suggestions are very welcome. The task starts off with: Reporter(chapters).report() thanks, --Tim Arnold from Queue import Empty from multiprocessing import Process, Queue def run_mp(objects,fn): q = Queue() procs = dict()

Re: Python & Sullivan

2011-08-10 Thread Tim Chase
On 08/10/2011 05:42 PM, Chris Angelico wrote: PS. I mistakenly sent this to a Gilbert& Sullivan group first. Oddly enough, opera-goers are not used to discussing the relative merits of braces vs indentation in code. It's only fair turnabout: http://coding.derkeiler.com/Archive/Python/comp.lan

Re: multiprocessing timing issue

2011-08-10 Thread Tim Roberts
Tim Arnold wrote: > >The task: >I have a bunch of chapters that I want to gather data on individually >and then update a report database with the results. >I'm using multiprocessing to do the data-gathering simultaneously. > >Each chapter report gets put on a Queue i

Re: Directions on accessing shared folder in windows network

2011-08-11 Thread Tim Golden
On 10/08/2011 21:43, Christian Heimes wrote: Am 10.08.2011 21:52, schrieb Ameet Nanda: Hi, Can anyone point me to a way to access windows shared folders from the network using a python script. I tried accessing using open, which is mentioned to work perfectly on the web, but it gives me followi

Re: multiprocessing timing issue

2011-08-11 Thread Tim Arnold
On 8/10/2011 11:36 PM, Philip Semanchuk wrote: On Aug 9, 2011, at 1:07 PM, Tim Arnold wrote: Hi, I'm having problems with an empty Queue using multiprocessing. The task: I have a bunch of chapters that I want to gather data on individually and then update a report database with the re

Re: How to Check Write Access of a Folder on Windows

2011-08-12 Thread Tim Golden
On 12/08/2011 11:41, Ayaskanta Swain wrote: Hi, I have a requirement where I need to check the write permissions on a directory on Windows platform. I don’t want to use the python function os.access( ), since it does not work correctly on Windows. It is giving incorrect results to me. Another o

Re: What Programing Language are the Largest Website Written In?

2011-08-12 Thread Tim Bradshaw
On 2011-08-02 15:41:06 +0100, ccc31807 said: Most of these are tech companies. Tech companies are very important, but so are other kinds of companies. What do manufacturing companies use, like Ford and Toyota, energy companies like BP and Exxon, pharmaceutical companies, consumer product compan

Re: allow line break at operators

2011-08-12 Thread Tim Chase
On 08/12/2011 05:50 PM, Chris Angelico wrote: You can write Perl code in the shape of a camel. Can you do that in Python? Okay. Open challenge to anyone. Write a Python script that outputs "Just another Python hacker" or some such message, and is shaped in some way appropriately. And no fair doi

Re: Ten rules to becoming a Python community member.

2011-08-14 Thread Tim Chase
On 08/14/2011 12:38 PM, Chris Angelico wrote: On Sun, Aug 14, 2011 at 6:21 PM, rantingrick wrote: WRONG: "We are supposed to write clean code but i am not used to that" RIGHT: "We are required to write clean code however i am not accustom to that way of thinking. Since when are we required t

Re: allow line break at operators

2011-08-14 Thread Tim Roberts
the author mistakenly typed a period instead of a comma: DO 10 I=1.8 That, unfortunately, is a perfectly valid statement that assigns the value "1.8" to the floating point variable "DO10I", supposedly resulting in the loss of an unmanned launch vehicle... -- Ti

Re: allow line break at operators

2011-08-15 Thread Tim Chase
On 08/14/2011 11:28 PM, Seebs wrote: I tend to write stuff like foo.array_of_things.sort.map { block }.join(", ") I like this a lot more than array = foo.array_of_things sorted_array = array.sort() mapped_array = [block(x) for x in sorted_array] ", ".join

Re: Windows service in production?

2011-08-16 Thread Tim Golden
On 16/08/2011 05:32, snorble wrote: Anyone know of a Python application running as a Windows service in production? I'm planning a network monitoring application that runs as a service and reports back to the central server. Sort of a heartbeat type agent to assist with "this server is down, go c

Re: Anyone here can do a comparation between Djang and RoR

2011-08-16 Thread Tim Chase
On 08/16/2011 04:15 AM, smith jack wrote: what is the advantage of Django over RoR:) *THE* advantage is that you get to program in Python instead of Ruby. :) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Tim Chase
On 08/16/2011 10:31 AM, Philip Semanchuk wrote: On Aug 16, 2011, at 11:12 AM, Chris Angelico wrote: There are several types of shadowing: 1) Deliberate shadowing because you want to change the behavior of the name. Extremely rare. 2) Shadowing simply by using the name of an unusual builtin (lik

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Tim Chase
On 08/16/2011 12:11 PM, Seebs wrote: Under which circumstance will you have more problems? 1. There is not a single shadowed built-in in the entire project. 2. There are dozens of shadowed built-ins based on when the original programmer felt there wasn't going to be a need for a given built-in

Re: Wait for a keypress before continuing?

2011-08-16 Thread Tim Roberts
the escape key. You are running this from a console process, and not a GUI process, right? >That means char=msvcrt.getch() is getting something? Did you ever think about inserting a debug statement to help you? print hex(ord(char)) -- Tim Roberts, t...@probo.com Providenza &

Re: string to unicode

2011-08-16 Thread Tim Roberts
v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x = '\xe8\x9f\x92\xe8\x9b\x87' >>> x.decode('utf8') u'\u87d2\u86c7' -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Idea for pure-python templates using AST.

2011-08-16 Thread Tim Roberts
essentially how the original CherryPy version 1 web framework worked.In the end, I think it was decided that this represented too much of a mix of processing and presentation, and CherryPy 2 and 3 use a different scheme. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: why i cannot import djang?

2011-08-16 Thread Tim Roberts
smith jack wrote: > >this package is already in the site-packages directory, but i cannot >import it , it's really confusing ... The package is called "django". The name you put in the subject line is wrong. Does your code use the right spelling? -- Tim Roberts, t

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread Tim Chase
On 08/16/2011 07:33 PM, John Gordon wrote: I stand by my assertion that the phrase "I used to do X" carries the meaning that you have done X in the past but DO NOT INTEND to do so in the future. I'd tweak the meaning to be something like "I did X regularly in the past and I no longer do it reg

Re: Windows service in production?

2011-08-17 Thread Tim Golden
On 16/08/2011 15:46, snorble wrote: Interesting. Normally I would use py2exe then do "myapp.exe -install" to install the app as a service. How do you handle installing the service? Also what does the service show under the properties, for the executable? "python.exe script.py" or something else?

Re: How to Check Write Access of a Folder on Windows

2011-08-17 Thread Tim Golden
On 16/08/2011 13:38, Ayaskant Swain wrote: Hi Tim, Thanks for your reply. It seems this issue is related to python bug -http://bugs.python.org/issue2528 But the patch code looks complex to me. I want to make changes only in my python script which will read an user given directory path& c

Re: lists and for loops

2011-08-18 Thread Tim Chase
On 08/18/2011 07:22 AM, Mark Niemczyk wrote: Or, using list comprehension. numbers = [1, 2, 3, 4, 5] numbers = [n + 5 for n in numbers] numbers [6, 7, 8, 9, 10] Or, if you want it in-place: numbers[:] = [n+5 for n in numbers] which makes a difference if you have another reference to numb

Re: List spam

2011-08-18 Thread Tim Golden
On 18/08/2011 13:58, Jason Staudenmayer wrote: I really like this list as part of my learning tools but the amount of spam that I've been getting from it is CRAZY. Doesn't anything get scanned before it sent to the list? I haven't seen any significant quantity of spam on the list for ages. (Th

Re: Wait for a keypress before continuing?

2011-08-21 Thread Tim Roberts
John Doe wrote: > >Tim Roberts wrote: > >> That exact code works perfectly for me. The function returns as >> soon as I press the escape key. You are running this from a >> console process, and not a GUI process, right? > >No. I am running this from wit

Re: To cmd.exe

2011-08-22 Thread Tim Golden
On 22/08/2011 14:21, aba ca wrote: How can I send to cmd.exe "netstat -an"? Look at the subprocess module, and especially the .check_output convenience function: http://docs.python.org/library/subprocess.html#subprocess.check_output TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting the time in Win7

2011-08-22 Thread Tim Golden
If memory serves, you need to enable a specific privilege to set the time in Vista+. Just a moment... Have a look here: http://support.microsoft.com/kb/300022 and look for SeSystemtimePrivilege generally. Sorry; I'm a bit rushed at the moment. Feel free to post back if that isn't clear TJG

Thoughts about documentation for non-python resource files

2011-08-22 Thread Tim Johnson
y own' protocol for generating documentations for these above-mention filetypes, I'd like to know if there is any such protocols being used already. Example : A pythonic way to generate documentations on a javascript file as well as its functions, objects etc. Any comments welcome

Re: Setting the time in Win7

2011-08-23 Thread Tim Golden
On 22/08/2011 20:42, Bob Greschke wrote: Several people have been hacking away on this computer we are testing on, so I'm not sure what settings -- other than all of them -- have been messed with, but popen("time ...") seems to work, but system("time ...") does not. I'm going to restore the machi

Re: Announcing a new podcast: Radio Free Python

2011-08-24 Thread Tim Chase
On 08/23/2011 11:15 PM, Larry Hastings wrote: Episode 1 has just been released! You can find it at http://www.radiofreepython.com/ as of this very minute. No Podcast/RSS feed...seriously? Downloaded manually and will listen later, but best left to podcatchers :) -tkc -- http://mail.pytho

Re: Unit test failing please help

2011-08-26 Thread Tim Wintle
On Fri, 2011-08-26 at 08:35 -0700, lblake wrote: > Hi I am new to python I am at bit lost as to why my unit test is > failing below is the code and the unit test: > > class Centipede(object): > legs, stomach This doesn't do what you think it does. "legs, stomach" is a statement and is not de

Re: Why PyImport_ExecCodeModule takes char*?

2011-08-28 Thread Tim Roberts
Mateusz Loskot wrote: > >I'm wondering, why PyImport_ExecCodeModule function takes char* >instead of const char*? My guess is "history". -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Instituições que utilizam Python.

2011-08-29 Thread Tim Delaney
ogle.com.au/search?q=python+brasil. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: Help parsing a text file

2011-08-30 Thread Tim Roberts
ML and slimy HTML, and "htmllib", which derives from it. I have used "htmllib" to parse HTML files where the tags were not properly closed. Perhaps you could start from "htmllib" and modify it to handle the quirks in your particular format. -- Tim Roberts, t..

Re: PC locks up with list operations

2011-08-31 Thread Tim Chase
ions, so I had to wade back out to the online docs to probe at it. Granted, after the fact, they were pretty obvious, but it would be nice if "help(resource.getrlimit)" gave me a hint as to what that one expected parameter should have been. -tim import resource as r token = &qu

Re: Detecting Ctrl-Alt-Del in Windows

2011-09-02 Thread Tim Golden
Obviously, this is a windows-based question. I know that Ctrl-Alt-Del is handled deep inside the OS, and I'm not trying to interrupt that. But is there some way to detect that a C-A-D has been pressed? Others have pointed out that this shouldn't really be possible for reasons of security. (And

sqlite3 with context manager

2011-09-02 Thread Tim Arnold
lf.b['id'])) my question is what happens if the update fails? Shouldn't it throw an exception? I ask because apparently something went wrong yesterday and the code never updated but I never got any warning. I rebooted the machine and everything is okay now, but I'd like to und

Re: Best way to print a module?

2011-09-05 Thread Tim Roberts
rce code, perhaps with syntax coloring. Surely there is no reason to have an "optimal" method of doing this -- this is never going to be in an inner loop. If you have a method that works, there is little justification to optimize... -- Tim Roberts, t...@probo.com Providenza & B

<    2   3   4   5   6   7   8   9   10   11   >