Re: Python thinks file is empty

2007-11-05 Thread Tim Roberts
If you wrote this: f.close (as reformed VB programmers tend to write) it would run without error or warning, but the file would not actually be closed. The data would be hung up the buffer, and the file would be 0 length. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python iPod challenge

2007-11-08 Thread Tim Chase
>>if you are interested please be so kind to visit: >> >> http://test-iq.web.cern.ch/test-iq/step1.php?lang=en > > Well, just out of curosity, i started the test, however, it seems a > little bugy. My answer to the first question one was: [snipped] > getting the following error: >

Re: How to output newline or carriage return with optparse

2007-11-08 Thread Tim Chase
>> ASIDE: I've started refactoring this bit out in my local >> source...how would I go about contributing it back to the >> Python code-base? I didn't get any feedback from posting to >> the Optik site. > > You can post a patch to bugs.python.org, but it will probably > just get forwarded to the

Re: How to output newline or carriage return with optparse

2007-11-08 Thread Tim Chase
> I'm trying to implement some simple command line options. > Some of the 'help' sections are long and I would like to > control line breaks. How do you do this? I had this problem earlier and solved it here: http://groups.google.com/group/comp.lang.python/browse_frm/thread/6df6e6b541a15bc2/09f2

Re: How to output newline or carriage return with optparse

2007-11-08 Thread Tim Chase
> Thanks for the help Tim. I just copied and pasted your code into a > file in my $PYTHONPATH (IndentedHelpFormatterWithNL.py), but I'm > getting the following error: > > class IndentedHelpFormatterWithNL(IndentedHelpFormatter): > NameError: name 'IndentedH

Re: Python Extension Building Network

2007-11-09 Thread Tim Golden
[EMAIL PROTECTED] wrote: > Hi, > > I am trying to get a small group of volunteers together to create > Windows binaries for any Python extension developer that needs them, > much like the package/extension builders who volunteer their time to > create Linux RPMs. > > The main thing I need are peo

Re: Python Extension Building Network

2007-11-09 Thread Tim Golden
[EMAIL PROTECTED] wrote: > The hardest part was finding accurate information. Most people on the > user groups have been unhelpful or sarcastic. That's a shame to hear. Because you were building on Windows? Or for some other reason? (I ask because, even here on the Python lists, reactions like "G

Re: Some "pythonic" suggestions for Python

2007-11-09 Thread Tim Roberts
have already been discovered. It's fine to say "those ideas have been proposed and rejected, see the PEPs", but I hope this group retains the tolerance that I have long admired. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: regex that is equivalent to perl's syntax

2007-11-12 Thread Tim Chase
> does python's re library have a similar capability of the perls > regular expression to > search for pattern that appears a variable number of times within the > lower and upper bounds given? For example, what is the python's > equivalent to the following perl's search string? > m/^\S{1,8}\.\S{0,

Re: Moving from java to python.

2007-11-12 Thread Tim Chase
> def __init__(self, connections = None, uid = None): > """ > Args: > [connections - a list of (connected node, weight) tuples. ] > [uid - an identifier for comparisons.] > """ > self._connected = [] > self._weights = [] > > if connections: >

Re: Volume id

2007-11-15 Thread Tim Golden
Gabor Urban wrote: > OK, you are right... Problem was not precise enough. I need to process CDs > to create a list. Does it ring a bell for you? On Windows, at least, you can do this with WMI: import win32com.client wmi = win32com.client.GetObject ("winmgmts:") for result in wmi.ExecQuery (

Re: Looking for docs

2007-11-16 Thread Tim Chase
> I'm not even sure what subject that @ sign stuff falls under. The magic keyword you're looking for is "decorator" which will help you find the docs (a quick google for "python decorator" returns scads of helpful results) -tkc -- http://mail.python.org/mailman/listinfo/python-list

insert comments into elementtree

2007-11-16 Thread Tim Arnold
7;: comElem = ET.SubElement(elem,ET.Comment('stopindex')) self.addComments(tree) filename = os.path.join(self.deliverloc,name) self.htmlcontent.write(tree,filename,encoding=self.encoding when I try this I get errors from the ElementTree _write method: TypeError: c

Re: Python too complex ?!?!?!

2007-11-17 Thread Tim Chase
> programmer, but he claims that the install, config, and > library models for C# have proved to be less > problematic than Python. So both his courses (intro, > data structs, algorithms) are taught in C#. A little anecdotal comparison from some of my experience with two web apps deployed at my

Re: Getting file timestamp from url

2007-11-17 Thread Tim Roberts
t sending it, but that's all you can find out. Plus, remember that web proxies can interfere with this. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: keyword parameter order

2007-11-18 Thread Tim Chase
> I am looking for a way to determine the order of keyword parameters > passed on to a class method. I'm fairly certain it's not possible, as how would code like this behave: def my_func(**kwd): kwd = OrderedDict(kwd) #magic happens here? return do_something(kwd) my_dict = {'hello':

Re: insert comments into elementtree

2007-11-19 Thread Tim Arnold
"Stefan Behnel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Arnold wrote: >> Hi, I'm using the TidyHTMLTreeBuilder to generate some elementtrees from >> html. One by-product is that I'm losing comments embedded in the html. > &

Re: Python too complex ?!?!?!

2007-11-19 Thread Tim Roberts
of modules on both Linux and Windows. >> > Try installing anything .NETish on Linux? Unfortunately, depending on your viewpoint, it works just fine, thanks to the hard work that has gone into the Mono project. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient (HUGE) prime modulus

2007-11-19 Thread Tim Roberts
sk today only includes 9 x 10**12 bits. Also consider that, by rough estimate, there are approximately 10**80 atoms in the known universe today... -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Variable-width lookbehind

2007-11-19 Thread Tim Roberts
d PL/I. They are attempting to pack in every feature that has ever been requested by every person in the known universe. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: marked-up Python code

2007-11-20 Thread Tim Chase
> "all" the Python parser has to do is skip the mark-up. [snip] > I know I can put the mark-up after a # and the problem is > solved trivially, but this will not work for all cases (e.g. > mark-up of single identifiers) and to be honest I was thinking > of recycling some mark-up capable editor a

Re: mimicking a file in memory

2007-11-20 Thread Tim Chase
> I thought about this approach originally, but here's the catch > there: the read method isn't the only method i need. mutagen > calls the seek method on the file object. urllib2 returns a > "file-like object" that does not have a seek method associated > with it, which means i'd have to extend ur

Re: sorting a list of list

2007-11-20 Thread Tim Chase
> are there available library or pythonic algorithm for sorting a list > of list depending on the index of the list inside the list of my > choice? The built-in sorted() function and the sort() method on various collections take an optional "key=function" keyword paramater with which you can pass

Re: [regex] Basic rewriting

2007-11-20 Thread Tim Chase
> I've been reading tutorials on regexes in Python, but I still > don't get it: > > > #!/usr/bin/python > > #myscript.py 0123456789 > > import sys,re > > #Turn 0123456789 into 01.23.45.67.89 > p = re.compile('(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)') > phone = p.sub('\1.\2.\3.\4.\5',sys.a

Re: Finding out what other tasks are running

2007-11-23 Thread Tim Golden
Jeremy C B Nicoll wrote: > Is there a cross-platform of determining what other processes (or in Windows > terms, other applications) are running? > > Is it possible in a cross-platform way to ask some other application to shut > down, wait a while, and then test to see if it did shut? > > Failing

Re: Finding out what other tasks are running

2007-11-23 Thread Tim Golden
Jeremy C B Nicoll wrote: > Is there a cross-platform of determining what other processes (or in Windows > terms, other applications) are running? > > Is it possible in a cross-platform way to ask some other application to shut > down, wait a while, and then test to see if it did shut? > >

Re: Finding out what other tasks are running

2007-11-23 Thread Tim Golden
Tim Golden wrote: > Jeremy C B Nicoll wrote: >> Is there a cross-platform of determining what other processes (or in Windows >> terms, other applications) are running? >> >> Is it possible in a cross-platform way to ask some other application to shut >> down, wait

Re: Compile Cheetah Template on Windows

2007-11-25 Thread Tim Roberts
, with tmpl = Template( file='page.tmpl' ) >2. How do I output the HTML to a file? I tried the following: > >FILE = open(filename, "wt") >FILE.writelines(output) >FILE.close() > >I get an error though that states that writelines() requires an >interabl

Re: count pages in a pdf

2007-11-27 Thread Tim Golden
[EMAIL PROTECTED] wrote: > is it possible to parse a pdf file in python? for starters, i would > like to count the number of pages in a pdf file. i see there is a > project called ReportLab, but it seems to be a pdf generator... i > can't tell if i would be able to parse a pdf file programmically

Re: Pulling data from a .asps site

2007-11-27 Thread Tim Williams
On 27/11/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > There's a government website which shows public data for banks. We'd > like to pull the data down programmatically but the data is "hidden" > behind .aspx... > > Is there anyway in Python to hook in directly to a browser (firefox or > IE

Re: looking for ocbc example

2007-11-28 Thread Tim Golden
Carl K wrote: > jay graves wrote: >> On Sep 21, 2:43 am, Tim Golden <[EMAIL PROTECTED]> wrote: >>> Carl K wrote: >>>> It seems there are 2 odbc modules - pyOdbc and mxOdbc - anyone know the >>>> difference? >>> In short, pyodbc is open sour

Re: string parsing / regexp question

2007-11-28 Thread Tim Chase
is pretty much a deal-breaker for using regexps, as you can't really nest things to arbitrary depths using regexps. You really do need a parser of sorts, and pyparsing[1] is one of the more popular parsers, and fairly easy to use. -tim [1] http://pyparsing.wikispaces.com/ -- http://m

Re: Bit Operations

2007-11-28 Thread Tim Chase
> I'm really confused on how t do it, maybe cause python is > type-less (dynamic typed) Being duck-typed doesn't really have anything to do with it. Python supports logical shifting and combining > i've a byte that naturally is composed from 2 nibbles hi&low, > and two chars.. like A nd B. What

Re: string parsing / regexp question

2007-11-28 Thread Tim Chase
Paul McGuire wrote: > On Nov 28, 1:23 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: >> As Tim Grove points out, ... > > s/Grove/Chase/ > > Sorry, Tim! No problem...it's not like there aren't enough Tim's on the list as it is. :) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Bit Operations

2007-11-28 Thread Tim Chase
>> >>> 0xff & (((0xff & a) << 4) | (0xff & b)) >> 150 >> >> or, if you're sloppy, >> >> >>> (a << 4) | b >> 150 > > Slightly OT, maybe - why exactly is the second alternative 'sloppy?' > I believe you, because I had a problem once (in Java) with bytes not > having the value I expected unless I d

Re: Lib for audio?

2007-11-29 Thread Tim Chase
>> I need to read microphone input and determine frequency. Is there a lib >> for that? Yet one more possibility includes the OpenAL Python bindings: http://home.gna.org/oomadness/en/pyopenal/index.html -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Split a String

2007-11-29 Thread Tim Chase
> I need to convert the string: '(a, b, "c", d, "e")' into the > following list ['a', 'b', 'c', 'd', 'e']. Much like a csv > reader does. I usually use the split function, but this > mini-monster wouldn't properly get split up due to those > random quotations postgresql returns to me. Uh...use the

Re: Compile Cheetah Template on Windows

2007-11-29 Thread Tim Roberts
brianrpsgt1 <[EMAIL PROTECTED]> wrote: >Tim, thank you very much for the reply. The 'cheetah' function is now >working! > >I am still having a problem creating the file. I continually get >errors. I am sure that it is something very simple. > >Below is t

Re: Oh no, my code is being published ... help!

2007-11-29 Thread Tim Roberts
assume that p7zip will be installed in /usr/bin/7za. That's not good. On many of my systems, I install all new packages into /usr/local/bin. Some people use /opt. You should really check the PATH to look for 7za. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

OT: Dovetail (was "Re: Yet another database question, please")

2007-11-30 Thread Tim Chase
>> and what Dabo does dovetails nicely. > > Dovetails? > > Sorry, English is not my native language ;) A carpentry term where two pieces of wood are formed to fit together to create the joint: http://images.google.com/images?q=dovetail Used metaphorically to mean "as if they were meant to fit

Re: "Python" is not a good name, should rename to "Athon"

2007-11-30 Thread Tim Golden
Tim Couper wrote: > but it would mean that a version for large duration projects would be > "MarAthon" ... Can't decide whether you were deliberately avoiding "long-running" there, Tim, or just missed the opportunity :) TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: "Python" is not a good name, should rename to "Athon"

2007-11-30 Thread Tim Couper
but it would mean that a version for large duration projects would be "MarAthon" ... Dr Tim Couper CTO, SciVisum Ltd www.scivisum.com Gerardo Herzig wrote: > [EMAIL PROTECTED] wrote: > >> Python is a good programming language, but "Python" is not a good &

Re: "Python" is not a good name, should rename to "Athon"

2007-11-30 Thread Tim Chase
>> In Athon, the first letter "A" could pronounce as [ e ] . > > For English speakers that pronunciation is just plain wrong. > > You're trolling, right? Yeth, obviouthly he ith... ;) (You'd think this was the Lisp ML, not Python... ) -tkc -- http://mail.python.org/mailman/listinfo/python

Re: PIL + show() + Vista

2007-11-30 Thread Tim Golden
Méta-MCI (MVP) wrote: > Hi, Tim! > > You are right, for shimgvw.dll (on XP / 2000, or some Vista). But > others Vista (ou users practice) had associate images with > WindowsPhotoGallery.exe. > > But shimgvw.dll already exist. > > I found that this line: >

Re: PIL + show() + Vista

2007-11-30 Thread Tim Golden
Méta-MCI (MVP) wrote: > Re! > > I have found the problem. On Vista, the Windows-Photo-Galery (soft > default displayer) don't wait. Even with START /WAIT (in Image.py & > _showxv), it don't wait. > > Then, like the preview don't wait, the (next) "DEL" run prior the end of > the launch of th

Re: PIL + show() + Vista

2007-11-30 Thread Tim Golden
Méta-MCI (MVP) wrote: [Excuse my execrable French below] > Sorry, I don't understand english. But, with Babelfish-translation, I > recovered essence... > (you should learn French ; yes! yes! yes!) Vraiment! > I have just try on another CPU, with a very new Vista-premium > (configuration of

Re: "Show this file in explorer"

2007-12-01 Thread Tim Golden
farsheed wrote: > I have a big problem. I have a list of files that my script find and > list them in a little gui. > I need this function: > > when i d-click on each item, I want explorer opens and selects that > item inside windows explorer. > like that beautiful buttom in iTunes. Experiment wi

Re: "Show this file in explorer"

2007-12-01 Thread Tim Golden
farsheed wrote: > That was great. Thanks so so much. > can you tell me where can I find that kind of trips? (assuming "kind of tips") I stuck "explorer command line options" into Google and... Bingo! (All right, I'm cheating a bit: I knew that explorer *had* comman

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Tim Chase
> I agree that Python is not a good name for a programming language, but > I'm afraid we're stuck with it. Well, the language was going to be called "One of the cross beams has gone out askew on the treadle" but that was a little unwieldy and hard to understand when mumbled in a hury. Searching f

Re: pythonw.exe and python.exe

2007-12-01 Thread Tim Roberts
ad, because that's where window events are delivered. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: python newbie - question about lexical scoping

2007-12-01 Thread Tim Roberts
ibe if models.comment() were a normal function that returns a single object, instead of a class name, as I have assumed. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: String formatting with %s

2007-12-02 Thread Tim Chase
> I'm sure I one read somewhere that there is a simple way to set the order > of replacements withing a string *without* using a dictionary. > > What I mean is: s = "%s and %s" % ( "A", "B" ) print s > A and B > > Now, is there something quick like: s = "%s/2 and %s/1" % ( "A", "B

Re: String formatting with %s

2007-12-03 Thread Tim Chase
>> dictionary-key/value syntax), you can do something like: > number = lambda x: dict((str(i+1), v) for (i,v) in enumerate(x)) > "%(2)s and %(1)s" % number(["A", "B"]) > > Whoa - that'll take me a little while to figure out, but it looks intriguing! It basically just returns a dictionary

Re: os.access() under windows

2007-12-03 Thread Tim Golden
Yann Leboulanger wrote: > Martin v. Löwis a écrit : >>> I create a folder test under e: >>> >>> then os.access('e:\\test', os.W_OK) returns True. Everything's ok. >>> >>> Now I move My Documents to this e:\test folder >>> >>> Then os.access('e:\\test', os.W_OK) returns False !! >> This description

Re: os.access() under windows

2007-12-03 Thread Tim Golden
Tim Golden wrote: > Yann Leboulanger wrote: >> Martin v. Löwis a écrit : >>>> I create a folder test under e: >>>> >>>> then os.access('e:\\test', os.W_OK) returns True. Everything's ok. >>>> >>>> Now I move My Do

Re: os.access() under windows

2007-12-03 Thread Tim Golden
Yann Leboulanger wrote: > Tim Golden a écrit : >> >> I'm happy to contribute a doc patch if I can imagine what >> exactly to write. >> > > "Don't use it under windows, always consider it's True"? Well, that's not the case for

Re: Process Id

2007-12-03 Thread Tim Golden
Navid Parvini wrote: > Dear All, > > Would you please help me to find a way to get the list of all processes id > on the machine along with their parent processes. > > Thank you in advance. Deja vu? http://groups.google.com/group/comp.lang.python/search?q=list+process TJG -- http:/

Re: os.access() under windows

2007-12-03 Thread Tim Golden
Yann Leboulanger wrote: > Ok thanks for all those information, I'll remove the call to os.access() > on folders for windows in my application. > FWIW, I think it's worth bearing in mind what was said earlier in this thread: it's easier to ask forgiveness than permission. Technically, even if os.

Re: Story generator....

2007-12-03 Thread Tim Chase
> i am not sure if this is at all possible i am trying to make a story > generator like the ones that i did in elementry school where they would > supply a story with blanks and you would have to place the nouns-verbs/you > best friends name and it would make a funny story. Sounds like yo

Re: Why Don't Return?

2007-12-03 Thread Tim Chase
> Here is sample function: > > def a(): > b() > print c > > def b(): > c = "Hi" > return c > > if __name__ == "__main__": > a() > > then run a(). Throws error about c not being defined. How do I return c from > b? you *do* return c from b, and within the scope of a(), c is not defin

Re: a n00b regex qestion

2007-12-03 Thread Tim Chase
> I tried these this: > > string = string.replace('\s*Field One\s* > %FieldOneValue%\s*', '') > > > But this doesn't work. The doco for Python's regex suggests that \s > should match any whitespace including newlines which is what I > wanted, from http://docs.python.org/lib/module-re.html "

Re: os.access() under windows

2007-12-04 Thread Tim Golden
Martin v. Löwis wrote: > It would be possible to fix this specific case, by always > returning True for directories; and perhaps I'll do that for > 2.5.2. Martin. Could you confirm that the outline below correctly describes the behaviour of the os.access function under Windows, please? If you conf

Re: Escaping the semicolon?

2007-12-04 Thread Tim Chase
> Is this expected behavior? > s = '123;abc' s.replace(';', '\;') > '123\\;abc' You're asking the interpreter to print a representation of your string, so it does so. Representations wrap the results in quotes and escape characters within that need escaping. >>> s.replace(';', '\;'

Re: os.access() under windows

2007-12-04 Thread Tim Golden
Martin v. Löwis wrote: >> Martin. Could you confirm that the outline below correctly >> describes the behaviour of the os.access function under >> Windows, please? > > It's correct for Python 2.5.2 and 2.6; for 2.5.1 (as discussed) > the test "if directory:return True" was not implemented. Thanks

Re: os.access() under windows

2007-12-04 Thread Tim Golden
Martin v. Löwis wrote: >> Now, ironically, I'm confused by your recap :) What I meant to say was >> that the os.access function as implemented under Windows returns False >> if the path in question (say, "x:\someones-private-docs\diary.doc") was >> inaccessible to the process invoking os.access by

Re: Why did no one tell me about import antigravity?

2007-12-05 Thread Tim Leslie
'm surprised by the muted response > on here. Don't forget to check out the alt. text on the comic > > Alt text: "I wrote 20 short programs in Python yesterday. It was > wonderful. Perl, I'm leaving you." > +1 QOTW Tim > > Regards > > Adrian

Re: os.access() under windows

2007-12-05 Thread Tim Golden
[apologies if this double-posts; my email server's playing up] Martin v. Löwis wrote: > In a POSIX world, you need read permission on the directory. > In Windows, with the "bypass-traversal-check" privilege, > you only need read permission on the directory if you want > to list it, not to acce

Re: os.access() under windows

2007-12-05 Thread Tim Golden
Martin v. Löwis wrote: > In a POSIX world, you need read permission on the directory. > In Windows, with the "bypass-traversal-check" privilege, > you only need read permission on the directory if you want > to list it, not to access a file in the directory. Is it > actually possible for GetFileAtt

Re: How to split string

2007-12-05 Thread Tim Chase
> In other words, the string should be split at every 10th possition but > if the 10th character is space, then the string must be split at the > nearest space before the 10th possition. > > It could be better explained if the length of split strings will be > 20. > > S='this is just a random seq

Re: sqlite or xml

2007-12-06 Thread Tim Chase
> how much data is considered to be "large amount"? one record Unless you really need XML to communicate with some other app via a predetermined schema, use a database to store and retrieve data. If you only need to send data to another app via a predetermined schema, use a database and then

Re: Dictionary instantiation?

2007-12-07 Thread Tim Golden
Matt_D wrote: [... snip loads ...] > Wow, list spam. Indeed. > Sorry about this. Good. > Anyway, disregard my last two. I get it now. Glad to hear it. Might I suggest, though, that it's not necessary to repeat the entire history of the thread on every email. Unless you have reason to repr

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > i want to use active directory of my firm to user authentication.i am > using active_directory module By the way, if what you want to do is user *authentication* (as opposed to authorisation) then the active_directory module won't be any good to you. You want to use eith

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > i want to use active directory of my firm to user authentication.i am > using active_directory module(Tim Golden's module - > http://tgolden.sc.sabren.com/python/active_directory.html). > > i am using windows vista with an administrative account,p

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: >> Hello, >> >> From a zone-file of a Microsoft Active Directory integrated DNS server >> I get the date/time of the dynamic update entries in a format, which >> is as far as I know the hours since january 1st 19

Re: Any simpler way to do this

2007-12-07 Thread Tim Golden
Lars Johansen wrote: > I have a function that looks like this: > > def Chooser(color): > > if color == "RED": > x = term.RED > elif color == "BLUE": > x = term.BLUE > elif color == "GREEN": > x = term.GREEN > elif col

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
Spindle wrote: > I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i > mentioned before, > the problem happens only with eclipse and pydev,on the same machine i > can run the script from command line or with IDLE without any errors. Well, that's bizarre then. Hopefully someone else

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
gurkan wrote: > i have treid the script : > > #import active_directory > import win32com.client > > win32com.client.Dispatch ("ADODB.Command") > #me = active_directory.find_user () > > #print me > > again i got the error : > > Traceback (most recent call last): > File "H:\dev\eclipse\workspa

Re: python and a 2 gigs Usb Stick (pure pythonic stick)

2007-12-07 Thread Tim Chase
> i've received for my birthday two usb key, and i had the idea to make > the 2GB one a special python usb key. > So far i've put on it : > Movable Python > My Python directory > Iron Python > Jython > Instant django > > the file installation for : > Python , iron python , jython , PIL , Pygame ,

Re: Securely distributing python source code as an application?

2007-12-07 Thread Tim Churches
this? You need to define what you mean by "securely" by specifying what types of threat you wish to protect against. Tim C -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm missing something here with range vs. xrange

2007-12-07 Thread Tim Chase
>> Here's what I get; >> >> xRange 92.552733 >> Range 95.266599 > > Try tracking your memory usage during the benchmark and > it will become very clear why xrange exists. Or, when memory-constrained and this extra memory usage pushes your machine to pound on your swap...not a pretty sight

Re: how to convert 3 byte to float

2007-12-08 Thread Tim Roberts
not that old). I was also wondering about >the reason for this limitation (maybe the design is ~20 years old). The IEEE-754 standard was adopted in 1985. Before that (and after that, too), many people used whatever bit layout they wanted for floating point numbers. -- Tim Roberts, [

Re: Best way to protect my new commercial software.

2007-12-10 Thread Tim Chase
> So you say there is not any trusted way? You cannot distribute any program with the expectation that it cannot be reverse engineered. Despite what various protection companies would have folks believe. At some point, the user's CPU has to execute the code, and at that point, it can be intercep

Re: Best way to protect my new commercial software.

2007-12-10 Thread Tim Chase
> So, are there any ways to make it "harder" to reverse engineer a > program? In addition to the standby of -Don't distribute your program (SaaS) I'll add to the list: -Only distribute your program to people too non-technical to consider reverse-engineering -Don't document your program (or eve

Re: Python Exponent Question

2007-12-10 Thread Tim Chase
databyss wrote: > I have a simple program and the output isn't what I expect. Could > somebody please explain why? > > Here's the code: > > #simple program > print "v = 2" > v = 2 > print "v**v = 2**2 =", v**v > print "v**v**v = 2**2**2 =", v**v**v > print "v**v**v**v = 2**2**2**2 =", v**v**v**v

Re: Best way to protect my new commercial software.

2007-12-10 Thread Tim Chase
greg wrote: > Tim Chase wrote: >> -Write Lovecraftian code ("import goto" comes to mind) designed >> to make reverse-engineers go insane trying to figure out what you >> were thinking > > The problem with that is it makes it hard for *you* to > figure out

Re: Serializing Python compiled code.

2007-12-10 Thread Tim Roberts
. Why not just store the raw code snippets? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Zipfile content reading via an iterator?

2007-12-11 Thread Tim Chase
I'm dealing with several large items that have been zipped up to get quite impressive compression. However, uncompressed, they're large enough to thrash my memory to swap and in general do bad performance-related things. I'm trying to figure out how to produce a file-like iterator out of the

Re:

2007-12-11 Thread Tim Chase
> How on earth do I convert strings to lists. I have a string > with a list it in it and I'm trying to convert it into a > list. Please help me. > > Ex."[16, 16, 2, 16, 2, 16, 8, 16]"-string to > [16, 16, 2, 16, 2, 16, 8, 16] -list If you trust your input, you can just do >>> s = "[16, 16, 2,

String of integers separated by commas surrounded by square brackets to a list (was Re:)

2007-12-11 Thread Tim Couper
) for s in s[1:-1].split(',')] Tim Dr Tim Couper CTO, SciVisum Ltd www.scivisum.co.uk katie smith wrote: > How on earth do I convert strings to lists. I have a string with a > list it in it and I'm trying to convert it into a list. Please help me. > > Ex."[16

Re: Zipfile content reading via an iterator?

2007-12-12 Thread Tim Chase
Gabriel Genellina wrote: >> I'm dealing with several large items that have been zipped up to >> get quite impressive compression. However, uncompressed, they're >> large enough to thrash my memory to swap and in general do bad >> performance-related things. I'm trying to figure out how to >> prod

Re: Pascal code checker!

2007-12-12 Thread Tim Chase
> I need to make application that would accept Pascal code and check if it > returns good results. well, it depends on how much work you want your program to do. My understanding is that most compilers will return a non-zero error code when there's some sort of problem. Thus, you could just s

Re: Pascal code checker!

2007-12-12 Thread Tim Chase
>> Oof! Fond as I am of promoting pyparsing, writing a Pascal >> compiler (or even just syntax checker) is not a job I would >> tackle lightly, much less suggest to a new Python developer. True enough...thus my weeks/months/years estimate for such an undertaking :) But if not mentioned, you

Re: sqlite weirdness

2007-12-12 Thread Tim Roberts
through that. >I'll have to refactor my code somewhat to force it to use the '-MM- >DD' format. Another possible solution is to use a real database. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between del and remove?

2007-12-13 Thread Tim Roberts
cause the number 2 was not in the list. Dictionaries do not have a "remove" method. You have to use the "del" statement. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic or not?

2007-12-13 Thread Tim Roberts
e floating point, that's only 2 megabytes. Piece of cake. With 1,000 in each group, it's 8 megabytes. Still no sweat. What are you going to do with these distances? Why do you need them all in memory? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python implementation of "include"

2007-12-13 Thread Tim Couper
import myFile would achieve this TIm [EMAIL PROTECTED] wrote: > Hello, > > I've been using the Python-based Karrigell web application framework. > It has the very handy word "include" that inserts a code file into > into the stream of execution. E.g. if myFile.p

Re: Loops and things

2007-12-14 Thread Tim Chase
> I was wondering how and if it's possible to write a loop in python > which updates two or more variables at a time. For instance, something > like this in C: > > for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { > printf("i = %d, j = %d\n", i, j); > } Well, yes it can be done, but depending

Re: Windows XP unicode and escape sequences

2007-12-14 Thread Tim Roberts
he NTVDM (the Virtual DOS Machine). 32-bit console apps (which Python is) simply cannot use ANSI escape sequences. You have to use the Win32 APIs to do color. There are curses-like libraries available for Python. Or: http://www.effbot.org/zone/console-handbook.htm -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing argument value

2007-12-15 Thread Tim Roberts
sult anywhere, the [3,4] list now has no names bound to it, and will get cleaned up. fooB(x) Like before, this is passing the two-element [1,2] list into fooB, where it gets bound to "y" inside fooB. Again, it has two names bound to it. Then, when you do y[0] = 3 you are changing

Re: Convert a sequence of bits to a bit-string

2007-12-15 Thread Tim Chase
> does anybody know how to convert a long > sequence of bits to a bit-string? I want to avoid this: > bit=00110101110111010001 I do not think this does what you think it does... http://docs.python.org/ref/integers.html The lead

<    40   41   42   43   44   45   46   47   48   49   >