Re: Possible error in 'dive into Python' book, help!

2006-07-28 Thread Tim Chase
>PUBLIC '-//diveintopython.org//DTD Kant Generator Pro v1.0//EN' > 'kgp.dtd'> I tried to reproduce your problem with the sample file you gave, but it gasped, wheezed and died with a traceback about entities. Likely for not also having this kgp.dtd file (and any other external files it r

Re: replacing single line of text

2006-07-28 Thread Tim Chase
> I want to be able to replace a single line in a large text file > (several hundred MB). Using the cookbook's method (below) works but I > think the replace fxn chokes on such a large chunk of text. For now, I > simply want to replace the 1st line (CSV header) in the file but I'd > also like to kn

Re: Need a compelling argument to use Django instead of Rails

2006-07-28 Thread Tim Roberts
keep database sessions open. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Small problem with print and comma

2006-07-30 Thread Tim Chase
> I have a small problem with my function: printList. I use print with a > ',' . Somehow the last digit of the last number isn't printed. I wonder > why. Posting actual code might help...the code you sent has a horrible mix of tabs and spaces. You've also got some craziness in your "creating r

Re: Finding the name of a class

2006-08-01 Thread Tim Chase
class Foo(object): > ... pass > ... b = Foo b.__name__ > 'Foo' While this is surely true, would somebody explain why I had such trouble finding this? help(dir) > Help on built-in function dir in module __builtin__: continuing from your example... >>> dir(b) ['__class

Re: Finding the name of a class

2006-08-01 Thread Tim Chase
>> While this is surely true, would somebody explain why I had such trouble >> finding this? > > I think __name__ is an attribute of the class itself, not the instance: That makes sense, but what doesn't make sense is why, when you do a dir(Foo), you don't get '__name__' in the returned list of

RE: Windows vs. Linux

2006-08-02 Thread Tim Golden
| [EMAIL PROTECTED] wrote: | | >>From a WinXP command prompt: | > | > C:\> | > C:\>cd /windows/system32 | > | > C:\WINDOWS\system32> | > | > | Not from my Windows XP command prompt it doesn't. Do you have | anything | strange installed on your system? FWIW: Microsoft Windows

Re: Windows vs. Linux

2006-08-02 Thread Tim Chase
> | Not from my Windows XP command prompt it doesn't. Do you have > | anything > | strange installed on your system? > > FWIW: > > > > Microsoft Windows XP [Version 5.1.2600] > (C) Copyright 1985-2001 Microsoft Corp. > > c:\temp>cd \ > > C:\>cd /windows/System32 > > C:\windows\system32> >

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Tim Chase
> The Ruby crowd says you guys are no where near as friendly as > them! I was half expecting a nervous breakdown after writing > my first post here. Maybe the Ruby folks have to be friendlier to make up for their language of choice... :*) The python mailing list is your pretty typical technical

Re: programming is hard

2006-08-03 Thread Tim Chase
> this site is contains code snippets for various languages and python > does not have many code snippet posters. Just lettting you know > > http://programmingishard.com In addition to Stefan's comment about the pre-existing repository for Python code snippets at http://aspn.activestate.com/AS

Re: OS independent files

2006-08-03 Thread Tim Chase
> location prior to pickling something to it. But I have a question > about it. In Windows I can make a file with this: > > os.path.join("C:", "myfiles", "myfile.dat") > > If I want to make sure the file/directory is made in a user's home > directory (e.g. /home/users/path/to/file) but also com

Re: help - iter & dict

2006-08-03 Thread Tim Chase
> Im trying to iterate through values in a dictionary so i can find the > closest value and then extract the key for that valuewhat ive done so far: > > def pcloop(dictionary, exvalue): > z = dictionary.itervalues() > y = z - exvalue > v = (y*y)**1/2 > if v < 0.

Re: regex question

2006-08-03 Thread Tim Chase
Gabriel Murray wrote: > Hello, I'm looking for a regular expression which will match strings as > follows: if there are symbols a, b, c and d, then any pattern is valid if it > begins with a and ends with d and proceeds in order through the symbols. > However, at any point the pattern may reset to

Re: regex question

2006-08-03 Thread Tim Chase
> That's great! Thanks for the quick response. Yeah, abcdcd should be > possible too. The below passes that test now as well as a couple others I tossed at it. I changed it from a one-line regexp to a VERBOSE regexp to make it easier to read and see what's going on. You may be able to see th

Re: looking for a regular expression

2006-08-03 Thread Tim Roberts
escape sequences. The vast majority of Usenet participants are now reading these articles through GUI newsreaders or web-based readers which show this as 5 lines of unrecognizable line noise. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: exception handling; python program that interacts with postgresql db

2006-08-03 Thread Tim Roberts
rt psycopg db = psycopg.connect( "dbname=template1 user=postgres password=%s" % password ) c = db.cursor() c.execute( "drop database mytempdb;" ) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

RE: encoding of a file

2006-08-04 Thread Tim Golden
[Thomas Thomas] | how can I find the encoding to use to open a file.. I have a | file with "£" chararcter.. | is there some utility function in python that I can use | | how can I know which encoding to use [This is going to be a longer answer than you really want. The short answer is "probabl

Re: Why do I require an "elif" statement here?

2006-08-04 Thread Tim Chase
> Could somebody tell me why I need the "elif char == '\n'" in > the following code? > > This is required in order the pick up lines with just spaces > in them. > Why doesn't the "else:" statement pick this up? Following through with the below code: if the line consists of only a newline, it get

Re: Why do I require an "elif" statement here?

2006-08-05 Thread Tim Chase
> Hard to believe that lstrip() produces an empty string on lines with > just spaces and doesn't remove the '\n' with lines that have > characters. It's easy to understand that lstrip() is doing exactly what it's supposed to. It evaluates from the left of your string, discarding whitespace (sp

Re: looking for a regular expression

2006-08-05 Thread Tim Roberts
"alex23" <[EMAIL PROTECTED]> wrote: >Tim Roberts wrote: >> What is your signature supposed to be? It looks like you are trying to >> inject ANSI terminal escape sequences. The vast majority of Usenet >> participants are now reading these articles through GU

Re: More int and float attributes

2006-08-05 Thread Tim Roberts
r system programming tasks, but in most cases, a Python programmer shouldn't need to worry about the internal representation of variables. Look, for example, at the blurred distinction between integers and long integers. I'm not arguing for or against the proposal, but I suspe

Re: Suppressing banner on interactive startup? [SOLVED]

2006-08-06 Thread Tim Chase
>> 1) is there a way to suppress the banner when starting Python >> interactively? [...] >> >> 2) is there a way to change the two prompts from ">>>" and "..." >> to other options? [...] > > I noticed that the first part of your query was never answered. > To combine both of these, try the fol

Re: Initializing the number of slots in a dictionary

2006-08-06 Thread Tim Peters
... [Jon Smirl] > I know in advance how many items will be added to the dictionary. Most > dictionary implementations I have previously worked with are more > efficient if they know ahead of time how big to make their tables. Richard Jones spent considerable time investigating whether "pre-sizing

Re: format a number for output

2006-08-07 Thread Tim Williams
On 7 Aug 2006 07:55:11 -0700, abcd <[EMAIL PROTECTED]> wrote: > if i have a number, say the size of a file, is there an easy way to > output it so that it includes commas? > > for example: > > 1890284 > > would be: > > 1,890,284 > I was bored !! >>> a = 1890284 >>> ','.join([str(a)[::-1][x:x+3] f

Re: Getting previous file name

2006-08-07 Thread Tim Williams
On 7 Aug 2006 13:52:16 -0700, Hitesh <[EMAIL PROTECTED]> wrote: > > I have a small script here that goes to inside dir and sorts the file > by create date. I can return the create date but I don't know how to > find the name of that file... > I need file that is not latest but was created before th

Re: Tkinter module not found

2006-08-08 Thread Tim Chase
> The cause of this is usually that you are using a different > version of Python than the one you installed Tkinter into, but > being a Linux newbie I have yet to discover how to redirect > the 'python' command to invoke the newer version of Python. The OS looks for the first 'python' it finds i

Re: (easy question) Find and replace multiple items

2006-08-08 Thread Tim Chase
> Hello, i'm looking to find and replace multiple characters in a text > file (test1). I have a bunch of random numbers and i want to replace > each number with a letter (such as replace a 7 with an f and 6 with a > d). I would like a suggestion on an a way to do this. Thanks Well, the canonical

Re: threading.Event usage causing intermitent exception

2006-08-08 Thread Tim Peters
[EMAIL PROTECTED] > Admittedly this problem causes no actual functional issues aside from > an occasional error message when the program exits. The error is: > > Unhandled exception in thread started by > Error in sys.excepthook: > Original exception was: > > Yes all that info is blank. That's ty

Re: Python share CPU time?

2006-08-09 Thread Tim Chase
> Problem is that I would have to share the CPU between all the robots, > and thus allocate a time period to each robot. However I couldn't find > any way to start a thread (robot), and interrupt it after a given time > period. > Any suggestions on how to proceed? >>> import thread, time >>> def

Re: Escape sequences (colour) and padding with "%8s"%

2006-08-09 Thread Tim Chase
> I used escape sequences to produce colour output, but a construct like > > print "%8s" % str_with_escape > > doesn't do the right thing. I suppose the padding counts the escape > characters, too. > > What could be a solution? You omit half of the equation: the contents of str_with_escape.

Re: timeout calling local sendmail

2006-08-09 Thread Tim Williams
On 9 Aug 2006 08:22:03 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > that's > "timeout calling local sendmail" > not > "timeout calling local se" > > > [EMAIL PROTECTED] wrote: > > (Environment: RedHat Linux recent, Python 2.3.5) > > > > We have a batch processing script that on occasion n

Re: do people really complain about significant whitespace?

2006-08-09 Thread Tim Roberts
as up to the programmer. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: using python at the bash shell?

2006-08-09 Thread Tim Roberts
or bash to process it, regardless of what program launched the script. The same thing works for Python scripts: #! /usr/bin/python -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.platform documentation?

2006-08-10 Thread Tim Golden
Michiel Sikma wrote: > Hello everybody, > > I was thinking about making a really insignificant addition to an > online system that I'm making using Python: namely, I would like it > to print the platform that it is running on in a human-readable > manner. I was thinking of doing it like this: [...

Re: easy string formating question

2006-08-10 Thread Tim Chase
> I have kind of an interesting string, it looks like a couple hundred > letters bunched together with no spaces. Anyway, i'm trying to put a > "?" and a (\n) newline after every 100th character of the string and > then write that string to a file. How would I go about doing that? Any > help woul

Re: seaching a list...

2006-08-10 Thread Tim Chase
> the issue of doing the string/list compare/search is that i can get > everything from the db with one call... i can then iterate through memory > for each of my row information that i'm searching to see if it exists in the > db... > > memory searches should be faster than the network overhead, a

RE: sys.platform documentation?

2006-08-11 Thread Tim Golden
[Michiel Sikma] | So if you run this script: | -- | import platform | platform.platform() | platform.uname() | -- | You will get all the information that is necessary. And then | you just | need to provide it with a human-determined name of the operating | system you're using. If you're inter

Re: hide python code !

2006-08-11 Thread Tim Chase
>> can we hide a python code ? >> if i want to write a commercial software can i hide my source code from >> users access ? >> we can conver it to pyc but this file can decompiled ... so ...!! > > All of these make it hard enough to deter most people who will ever > want to abuse your source code.

Re: datetime to timestamp

2006-08-11 Thread Tim Peters
[Simen Haugen] >>> How can I convert a python datetime to a timestamp? It's easy to convert >>> a timestamp to datetime (datetime.datetime.fromtimestamp(), but the >>> other way around...?) [John Machin] >> Is the timetuple() method what you want? >> >> #>>> import datetime >> #>>> n = datetime.da

Re: Tab delimited file

2006-08-11 Thread Tim Chase
> However as far as I know Python does not allow you to easily change a > specific line in a text file. You have to place the whole file to memory, > change what you need to and then write the file back after deleting the > previous information. > > Assuming this is true, how do i find where the

Re: Read a file with open command

2006-08-11 Thread Tim Williams
On 11 Aug 2006 09:39:23 -0700, jean-jeanot <[EMAIL PROTECTED]> wrote: > Anyway many thanks.Here is the program: > > >>> file_obj= open ("D:/Mes documents/ADB Anna.ods",'r') > >>> s = file_obj > >>> s.readlines() Please remember not to top-post :) Try this >>> s = open ("D:/Mes documents/ADB Ann

Re: Inconsistency producing constant for float "infinity"

2006-08-11 Thread Tim Peters
[Peter Hansen] >> I'm investigating a puzzling problem involving an attempt to >> generate a constant containing an (IEEE 754) "infinity" value. (I >> understand that special float values are a "platform-dependent >> accident" etc...) [also Peter] > ... > My guess about marshal was correct. Yup.

Re: Regd:Video Converter Programming

2006-08-11 Thread Tim Roberts
ecompression process to get to a series of bitmaps, then go through the whole AVI compression process to get a movie. If you are on Windows, you almost certainly want to use DirectShow to do this job. There is a DirectShow interface for Python. -- - Tim Roberts, [EMAIL PROTECTED]

Re: Password authentication systems

2006-08-12 Thread Tim Scheidemantle
Enabling shadow passwords stores them in /etc/shadow which is not world readable unlike /etc/passwd. They would be encrytped regardless of the file they are in. AlbaClause wrote: > [EMAIL PROTECTED] wrote: > > >> This may only be tangentially related to Python, but since I am coding >> a pa

Re: trouble with replace

2006-08-12 Thread Tim Chase
pats = ['abcdef', 'defgef', 'effwer'] reps = ['highway', 'news', 'monitor'] s = 'defgefabcdefy\n\n\n effwerbyuuuterrfr' reduce(lambda x,y: x.replace(*y), zip(pats,reps), s) The reduce() method fairly works well if you have it as a dictionary as well: >>> m = {'effwer':

Re: Inconsistency producing constant for float "infinity"

2006-08-12 Thread Tim Peters
[Tim Peters] >... >> It has a much better chance of working from .pyc in Python 2.5. >> Michael Hudson put considerable effort into figuring out whether the >> platform uses a recognizable IEEE double storage format, and, if so, >> marshal and pickle take di

Re: _PyLong_FromByteArray

2006-08-12 Thread Tim Peters
[Dan Christensen] > My student and I are writing a C extension that produces a large > integer in binary which we'd like to convert to a python long. The > number of bits can be a lot more than 32 or even 64. My student found > the function _PyLong_FromByteArray in longobject.h which is exactly >

Re: Nested if and expected an indent block

2006-08-13 Thread Tim Williams
On 13 Aug 2006 16:28:45 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Greetings: > > I'm brand new to Python and decided to write a syllogism solver for a > class I'm taking. At the start of the program, I define a function that > classifies the type of each statement in the syllogism. Pyth

Re: help parsing this

2006-08-14 Thread Tim Chase
>> how to parse this date > > parse it into what? there is no such thing as "April 31st". I think somebody's chain is getting pulled...thus the right thing to do is to wrap around and return "April 1st" ;-) -Loof Lirpa -- http://mail.python.org/mailman/listinfo/python-list

Re: A little assistance with os.walk please.

2006-08-14 Thread Tim Chase
> The os.walk function walks the operating systems directory tree. Yup. > This seems to work, but I don't quite understand the tupple that is > returned... > Can someone explain please? > > for root, dirs, files in os.walk('/directory/'): > print root > # print dirs > # print files

Re: why the method get() of python Queue is hang on there?

2006-08-14 Thread Tim Chase
> import Queue > b = Queue.Queue(0) > b.put() > b.get() # this is ok, it pops out > b.get() # this one does not return anything and is hang on > there > > Anybody knows what is going on with the second b.get()? >>> help(Queue.Queue) : : | get(self, block=True, timeout=None) |

Re: A little assistance with os.walk please.

2006-08-14 Thread Tim Chase
> 1) there seems to be an optional topdown flag. Is that passed to > os.walk(path, topdownFlag) Yes. > 2) I only want to process files that match *.txt for example... Does > that mean I need to parse the list of files for the .txt extention or > can I pass a wildcard in the path parameter? >>

Re: A little assistance with os.walk please.

2006-08-14 Thread Tim Chase
> >>> allowed = ['.txt', '.sql'] > >>> for path, dirs, files in os.walk("."): > ... for f in files: > ... if splitext(f)[1].lower() not in allowed: continue Additionally, if you really do want to specify wildcards: >>> allowed = ['*.txt', 'README*', '*.xml', '*.htm*'] >>> from

Re: Memory problem

2006-08-14 Thread Tim Chase
> I need to read a large amount of data into a list. So I am trying to > see if I'll have any memory problem. When I do > x=range(2700*2700*3) I got the following message: > > Traceback (most recent call last): > File "", line 1, in ? > MemoryError > > Any way to get around this problem? I

RE: What would be the best way to run python client in the background

2006-08-15 Thread Tim Golden
[gel] | I have written a python client server app [...] | I want to run the client end of the app more or less invisibly | (no console) on the XP clients when ever a users logs on. You say "when[]ever a user logs on" but does this app need to be run on a per-user basis? Or could it run all the

Re: Beginner Textbook

2006-08-15 Thread Tim Williams
On 15/08/06, M_M <[EMAIL PROTECTED]> wrote: > Hi, > > I am looking for a simple text book to introduce 13 to 18 year olds to > python programming. Suggestion? > You might consider "Learn to programme using Python" by Alan Gauld as a means to introduce both programming and python at the same time.

Re: round not rounding to 0 places

2006-08-16 Thread Tim Leslie
sult of the value > to one decimal place with a zero > > EG: > > 4.97 is returned as 5.0 when i want it returned as 5, does > anyone know why this is and if i can get the round to make > the value 5? round returns a float. You probably want to convert it to an int. >>

RE: What would be the best way to run python client in the background

2006-08-16 Thread Tim Golden
| Tim Golden wrote: | | > [gel] | > | > | I have written a python client server app [...] | > | I want to run the client end of the app more or less invisibly | > | (no console) on the XP clients when ever a users logs on. [Tim G] | > The normal way is to run a Win32 service.

RE: What would be the best way to run python client in the background

2006-08-16 Thread Tim Golden
| > [gel] | > | > | I have written a python client server app [...] | > | I want to run the client end of the app more or less invisibly | > | (no console) on the XP clients when ever a users logs on. While this isn't answering the question you first asked, might I suggest an alternative approach?

Re: Adding a char inside path string

2006-08-16 Thread Tim Williams
On 16/08/06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 16 Aug 2006 09:00:57 -0700, "Hitesh" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > > > Thank you Fredrik. That works for a string. > > But I am getting list of tuples from DB. > > > > rows = [('\\serverName\C:

Re: Adding a char inside path string

2006-08-16 Thread Tim Williams
On 16 Aug 2006 10:30:26 -0700, Hitesh <[EMAIL PROTECTED]> wrote: > > Thank you all it worked!. > > Tim, > > > modRows = ['\\'+itm[0].replace(":", "$") for itm in rows] > > What are those two forward slashes for? Hi Hitesh, \ is an

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Tim Williams
On 16 Aug 2006 15:23:06 -0700, fuzzylollipop <[EMAIL PROTECTED]> wrote: > I want to do email address format validations, without turning to ANTLR > or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. > Most of the ones I have found from google searches are not really as > robust as

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Tim Williams
On 17/08/06, Tim Williams <[EMAIL PROTECTED]> wrote: > On 16 Aug 2006 15:23:06 -0700, fuzzylollipop <[EMAIL PROTECTED]> wrote: > > I want to do email address format validations, without turning to ANTLR > > or pyparsing, anyone know of a regex that is COMPLIANT with RFC

Re: Adding a char inside path string

2006-08-17 Thread Tim Williams
On 17/08/06, Sybren Stuvel <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber enlightened us with: > > What happens when you get a pathname that looks like: > > > > \\who\cares\common.exe\program.exe > > Is that possible on Windows? At one point, I named a directory > "www.something.com" and then

Looking For mp3 ID Tag Module

2006-08-17 Thread Tim Daneliuk
is limited to the older ID tags that are severely limited in length and thus truncate the description strings I am providing. Ideas anyone? -- -------- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundrawa

Re: Looking For mp3 ID Tag Module

2006-08-17 Thread Tim Daneliuk
Iñigo Serna wrote: > Hi Tim, > > try mutagen. http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen > > Regards, > Iñigo Many thanks - this looks promising... -------- Tim Daneliuk [EMAIL

Re: CGI script running not completely in HTML

2006-08-17 Thread Tim Chase
> In which case you probably need to tweak the server timeout > setting. Nothing you can do from Python (except possibly make > your CGI run faster). Or have Python send a better SQL statement that would run faster...a little SQL mojo goes a long way. The OP failed (as far as my thread-dabbling

Re: re.sub() backreference bug?

2006-08-17 Thread Tim Chase
> s = re.sub(r'([A-Z]+)([A-Z][a-z])', "\1_\2", s) > s = re.sub(r'([a-z\d])([A-Z])', "\1_\2", s) > i expect to get: > hello_world19_foo_bar > > but instead i get: > hell☺_☻orld19_fo☺_☻ar Looks like you need to be using "raw" strings for your replacements as well: s = re.sub(r'([A-Z]+)([A-Z][a-z

Re: re.sub() backreference bug?

2006-08-17 Thread Tim Chase
> Tim's given you the solution to the problem: with the re module, > *always* use raw strings in regexes and substitution strings. "always" is so...um...carved in stone. One can forego using raw strings if one prefers having one's strings looked like they were trampled by a stampede of creatu

Re: Looking For mp3 ID Tag Module

2006-08-17 Thread Tim Daneliuk
Iñigo Serna wrote: > On 8/18/06, Tim Daneliuk <[EMAIL PROTECTED]> wrote: >> > try mutagen. >> http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen >> >> This module is more-or-less exactly what I needed. However, I am running >> into problems

RE: Looking For mp3 ID Tag Module

2006-08-18 Thread Tim Golden
[Tim Daneliuk] | >> audio["title'] = Something based on the filename that has unicode | >> chars in it | >> | >> UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc | in position | >> 56: ordinal not in range(128) | I am trying to se

RE: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Tim Golden
[Dirk Hagemann] | Hi! | Is it somehow possible to access an MS SQL Server database from python | by NT-Authentication or do I have only the possibility to use an | SQL-Account with DB = odbc.odbc(myDB/myAccount/myPW) ? (dsn examples from http://www.connectionstrings.com/) + Object Craft MSSQL mo

RE: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Tim Golden
[Dirk Hagemann] | I think the adodbapi module is interesting. I just tried it | out but got this error: | 'Exception occurred.', (0, 'Microsoft OLE DB Provider for ODBC | Drivers', "[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed | for user '(null)'. Reason: Not associated with a trus

Re: how do you get the name of a dictionary?

2006-08-18 Thread Tim Chase
> Does anyone know how to find the name of a python data type. > > Conside a dictionary: > > Banana = {} > > Then, how do i ask python for a string representing the name of the > above dictionary (i.e. 'Banana')? AFAIK, there's no easy/good way of doing this because that name is just a handle

Re: a bug in list.remove?

2006-08-18 Thread Tim Chase
> I have 2 lists. What Im doing is check the first list and remove all > occurances of the elements in the second list from the first list, like so: > >>> ps = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] > >>> qs = [6,7,8,9,10,11,12,1,2] > >>> for p in ps: > if p in qs: > ps.remove(p) >

Re: how do you get the name of a dictionary?

2006-08-18 Thread Tim Chase
>>> for i in dir(): >>> if eval(i) == Banana: >>> print i >> (sound of head hitting desk) >> >> >> > lol As freakish as the solution was, it's not too far off from something that actually works (mostly, kinda sorta): >>> banana = {} >>> spatula = banana >>> propane = {} >>

Re: write eof without closing

2006-08-19 Thread Tim Chase
>> can i write a eof to a file descriptor without closing it? > > No. Not on Windows, OS-X, or Unix. There is no such thing as > "an eof". > > On CP/M Ctrl-Z is used as EOF for text files. Common Dos/Window convention also uses ctrl+Z (0x1a) for EOF. c:\> copy con test.txt hel

Re: install patch on windows

2006-08-19 Thread Tim Golden
djoefish wrote: > Does anyone know how to install a patch on Winodws? For example, I want > to install the patch 'ocmalloc-free-arenas.diff' in Python 2.3. You can get patch (and quite a lot besides) for win32 from the UnxUtils project: http://sourceforge.net/projects/unxutils TJG -- http://ma

Re: Problem of function calls from map()

2006-08-21 Thread Tim Lesher
Dasn wrote: > So how to put '\t' argument to split() in map() ? How much is the lambda costing you, according to your profiler? Anyway, what you really want is a list comprehension: l = [line.split('\t') for line in lines] -- http://mail.python.org/mailman/listinfo/python-list

Re: List Splitting

2006-08-21 Thread Tim Chase
> For the purposes of this question, the list will be: > > t = [ "a", "b", "c", "n", "a", "a", "t", "t", "t" ] > > Now, I know that every 3rd element of the list belongs together: > > Group 1 = 0, 3, 6 > Group 2 = 1, 4, 7 > Group 3 = 2, 5, 8 > > I'm trying to sort this list out so that I get a

Re: Unclear on argument passing to "sendmail'

2006-08-21 Thread Tim Williams
print x[0], x[1] server.quit() break except: #can't connect so continue to next MX server - don't fail !!! e_error = str(sys.exc_info()[0]) print e_error server.quit() continue for recip in failed: # some failed, some didn't print recip -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: Unclear on argument passing to "sendmail'

2006-08-21 Thread Tim Williams
On 21/08/06, Tim Williams <[EMAIL PROTECTED]> wrote: > On 21/08/06, John Draper <[EMAIL PROTECTED]> wrote: Sorry, there's an indentation error here except smtplib.SMTPRecipientsRefused, x : #all recips failed for recip in x.recipients: print recip server.qui

RE: Add users to directory/folder and set permissions in Windows

2006-08-22 Thread Tim Golden
[Adam Jones] | | Gallagher, Tim (NE) wrote: | > I was wondering if there was a way to add a user in active | directory to | > a folder and set the permissions. | | It should be possible. If you can use VBScript or JScript it will be | easier to find resources for those. You will probabl

Re: What do you want in a new web framework?

2006-08-22 Thread Tim Roberts
uld never happen. Python would simply fall off of the list of options, and the job would get done in PHP or Ruby on Rails. I agree with Marc. PLEASE do not create "yet another Python web framework." Let's pick one, and join together to turn it into the One, True, Unquestioned Web Solution. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unclear on argument passing to "sendmail'

2006-08-22 Thread Tim Roberts
"mail.t-mobile.com" which I get from the MX record for >a given domain? >But also, is the "email" just the mail account, ie: the username? >without the @? Tim William's answer is not exactly correct. The host you specify in the smtplib.SMTP constructor shoul

RE: How can I enumerate all windows services and disable some of them?

2006-08-22 Thread Tim Golden
[EMAIL PROTECTED] | I know that Module win32service has some functions on manipulating | win32 services. | But I still have 2 questions: | 1. how to enumerate all services? | 2. how to disable a certain one? You can use WMI to do this if you want. Have a look at this example: http://tgolden.sc.

RE: How can I enumerate all windows services and disable some of them?

2006-08-22 Thread Tim Golden
[Tim Golden] | [EMAIL PROTECTED] | | | I know that Module win32service has some functions on manipulating | | win32 services. | | But I still have 2 questions: | | 1. how to enumerate all services? | | 2. how to disable a certain one? | | You can use WMI to do this if you want. ... or I could

RE: How to get database metadata information (i.e. existing tables andcolumns in tables)

2006-08-22 Thread Tim Golden
[Chris Brat] | Is it possible to retrieve details about the database, specifically a | list of the tables in the database; and then to retrieve the columns | and their types for the tables? | | Is this dependant on the database? In effect it's dependent on the database. We're assuming you're ta

Re: Unclear on argument passing to "sendmail'

2006-08-22 Thread Tim Williams
On 22/08/06, Tim Roberts <[EMAIL PROTECTED]> wrote: > John Draper <[EMAIL PROTECTED]> wrote: Hi Tim :) > Tim William's answer is not exactly correct. The host you specify in the > smtplib.SMTP constructor should NOT be the MX record for any of the > recipients. You

RE: Unicode Error

2006-08-23 Thread Tim Golden
[Gallagher, Tim (NE)] | Hey all I am learning Python and having a fun time doing so. | I have a question for y'all, it has to do with active directory. | I want to get the last login for a computer from Active | Directory. I am using the active_directory module and here | is my

Re: How can I enumerate all windows services and disable some of them?

2006-08-23 Thread Tim Golden
Tim Golden wrote: > [Tim Golden] > > | [EMAIL PROTECTED] > | > | | I know that Module win32service has some functions on manipulating > | | win32 services. > | | But I still have 2 questions: > | | 1. how to enumerate all services? > | | 2. how to disable a certain one?

RE: MS SQL Server: NT Authentication. Possible?

2006-08-23 Thread Tim Golden
[Dirk Hagemann] | Now I found this work-around: [... snip opening restricted file ...] | And this works! [...] So on the one hand the IIS works fine with the | fileserver, but the IIS does not work with the SQL-Server. And it seems | not to be the fault of the code, because it works when it's e

Re: Regex help...pretty please?

2006-08-23 Thread Tim Chase
> cond(a,b,c) > > and I want them to look like this: > > cond(c,a,b) > > but it gets a little more complicated because the conds themselves may > have conds within, like the following: > > cond(0,cond(c,cond(e,cond(g,h,(ahttp://mail.python.org/mailman/listinfo/python-list

Re: sum and strings

2006-08-23 Thread Tim Chase
> Maybe he's just insisting on the principle of least surprise? > Personally, I'd rather expect sum() to work for strings and Python to > issue a warning instead of raising a type error. That warning might > also be appropriate when using sum() on other builtin sequence types. In its own way, it m

Re: CGI Tutorial

2006-10-04 Thread Tim Chase
> I'm just building a Python CGI Tutorial and would appreciate > any feedback from the many experts in this list. First item of feedback...post something on which to give feedback, such as a link to the work in progress. :) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI Tutorial

2006-10-04 Thread Tim Chase
>> I'm just building a Python CGI Tutorial and would appreciate any >> feedback from the many experts in this list. > > http://webpython.codepoint.net Thanks! :) My first note would be regarding http://webpython.codepoint.net/shell_commands The code is very dangerous...allowing any ol' schmoe

Re: Where is Python in the scheme of things?

2006-10-04 Thread Tim Chase
Not sure if this is a troll...I've seen several of these sorts of posts on the list. But it seems innocent enough, so I'll bite. :) I'm not sure Delphi is really one of the "big 3"...surprisingly Java and C# don't make your list. > What is particularly disappointing is the absence of a Windows >

Re: Python to use a non open source bug tracker?

2006-10-04 Thread Tim Peters
better manners. That always calms things down again. loving-usenet-despite-that-it's-usenet-ly y'rs - tim -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I correct an error in an old post?

2006-10-05 Thread Tim Roberts
rrored on a web site somewhere, this is a Usenet newsgroup. It is impossible to "close" a thread. The concept simply does not exist. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: hex sending

2006-10-05 Thread Tim Roberts
"hiroc" <[EMAIL PROTECTED]> wrote: >s.send("abc") # send test string > >I need to send hex:"10 06 00 0f 02 bc d1" instead of "abc" > >hoW? One ugly way is s.send( "\x10\x06\x00\x0f\x02\xbc\xd1" ) -- - Tim Roberts, [EMAIL

<    27   28   29   30   31   32   33   34   35   36   >