Parallelization in Python 2.6

2009-08-18 Thread Robert Dailey
I'm looking for a way to parallelize my python script without using typical threading primitives. For example, C++ has pthreads and TBB to break things into tasks. I would like to see something like this for python. So, if I have a very linear script: doStuff1() doStuff2() I can parallelize it

How to create functors?

2009-08-18 Thread Robert Dailey
Hello, I want to simply wrap a function up into an object so it can be called with no parameters. The parameters that it would otherwise have taken are already filled in. Like so: print1 = lambda: print( Foobar ) print1() However, the above code fails with: File

Re: How to create functors?

2009-08-18 Thread Robert Dailey
On Aug 18, 3:31 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Robert Dailey rcdai...@gmail.com wrote: Hello, I want to simply wrap a function up into an object so it can be called with no parameters. The parameters that it would otherwise have taken are already filled in. Like so

Re: How to create functors?

2009-08-18 Thread Robert Dailey
On Aug 18, 3:31 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Robert Dailey rcdai...@gmail.com wrote: Hello, I want to simply wrap a function up into an object so it can be called with no parameters. The parameters that it would otherwise have taken are already filled in. Like so

Re: How to create functors?

2009-08-18 Thread Robert Dailey
On Aug 18, 3:40 pm, Chris Rebert c...@rebertia.com wrote: On Tue, Aug 18, 2009 at 1:32 PM, Robert Daileyrcdai...@gmail.com wrote: On Aug 18, 3:31 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Robert Dailey rcdai...@gmail.com wrote: Hello, I want to simply wrap a function up

Re: Parallelization in Python 2.6

2009-08-18 Thread Robert Dailey
On Aug 18, 3:41 pm, Jonathan Gardner jgard...@jonathangardner.net wrote: On Aug 18, 11:19 am, Robert Dailey rcdai...@gmail.com wrote: I'm looking for a way to parallelize my python script without using typical threading primitives. For example, C++ has pthreads and TBB to break things

Re: How to create functors?

2009-08-18 Thread Robert Dailey
around it -- this page   (http://p-nand-q.com/python/stupid_lambda_tricks.html) has some   suggestions. On Tue, 18 Aug 2009 13:32:55 -0700, Robert Dailey rcdai...@gmail.com   wrote: On Aug 18, 3:31 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Robert Dailey rcdai...@gmail.com

Re: How to create functors?

2009-08-18 Thread Robert Dailey
On Aug 18, 3:51 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 18-08-2009 o 22:32:55 Robert Dailey rcdai...@gmail.com wrote: On Aug 18, 3:31 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Robert Dailey rcdai...@gmail.com wrote: Hello, I want to simply wrap a function up

Re: Need cleanup advice for multiline string

2009-08-12 Thread Robert Dailey
On Aug 12, 9:09 am, exar...@twistedmatrix.com wrote: On 01:27 pm, jeanmic...@sequans.com wrote: Simon Brunning wrote: 2009/8/11 Robert Dailey rcdai...@gmail.com: On Aug 11, 3:40 pm, Bearophile bearophileh...@lycos.com wrote: There are gals too here. It's a figure of speech. And besides

Re: Need cleanup advice for multiline string

2009-08-12 Thread Robert Dailey
On Aug 12, 9:41 am, Robert Dailey rcdai...@gmail.com wrote: On Aug 12, 9:09 am, exar...@twistedmatrix.com wrote: On 01:27 pm, jeanmic...@sequans.com wrote: Simon Brunning wrote: 2009/8/11 Robert Dailey rcdai...@gmail.com: On Aug 11, 3:40 pm, Bearophile bearophileh...@lycos.com wrote

Multithreaded library for Python?

2009-08-12 Thread Robert Dailey
Hey guys, I realize the python library has multithreading support in it, but not the kind I'm really looking for. I want something like Intel's TBB, but for Python 3.1. I need to be able to spawn off Tasks that operate until completed and then end by themselves. I could create my own framework

Need cleanup advice for multiline string

2009-08-11 Thread Robert Dailey
Hey guys. Being a C++ programmer, I like to keep variable definitions close to the location in which they will be used. This improves readability in many ways. However, when I have a multi-line string definition at function level scope, things get tricky because of the indents. In this case

Re: Need cleanup advice for multiline string

2009-08-11 Thread Robert Dailey
On Aug 11, 3:08 pm, Robert Dailey rcdai...@gmail.com wrote: Hey guys. Being a C++ programmer, I like to keep variable definitions close to the location in which they will be used. This improves readability in many ways. However, when I have a multi-line string definition at function level

Bug in format specification in Python 3?

2009-08-11 Thread Robert Dailey
Hello, According to the Python 3.1 documentation, I can have a format specification like so: print( 'This is a hex number: {:#08x}'.format( 4 ) ) This will print: This is a hex number: 0x04 I notice that the '0x' portion is counted in the width, which was specified as 8. This seems wrong

Re: Need cleanup advice for multiline string

2009-08-11 Thread Robert Dailey
On Aug 11, 3:40 pm, Bearophile bearophileh...@lycos.com wrote: Robert Dailey: This breaks the flow of scope. Would you guys solve this problem by moving failMsg into global scope? Perhaps through some other type of syntax? There are gals too here. This may help:http://docs.python.org

Subclass dynamically

2009-08-08 Thread Robert Dailey
Hey, I have a class that I want to have a different base class depending on a parameter that I pass to its __init__method. For example (pseudocode): class MyDerived( self.base ): def __init__( self, base ): self.base = base Something like that... and then I would do this: foo =

Help with regex

2009-08-06 Thread Robert Dailey
Hey guys, I'm creating a python script that is going to try to search a text file for any text that matches my regular expression. The thing it is looking for is: FILEVERSION #,#,#,# The # symbol represents any number that can be any length 1 or greater. Example: FILEVERSION 1,45,10082,3 The

Character encoding the copyright symbol

2009-08-06 Thread Robert Dailey
Hello, I'm loading a file via open() in Python 3.1 and I'm getting the following error when I try to print the contents of the file that I obtained through a call to read(): UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in position 1650: character maps to undefined The file

Re: Help with regex

2009-08-06 Thread Robert Dailey
On Aug 6, 11:02 am, MRAB pyt...@mrabarnett.plus.com wrote: Robert Dailey wrote: Hey guys, I'm creating a python script that is going to try to search a text file for any text that matches my regular expression. The thing it is looking for is: FILEVERSION #,#,#,# The # symbol

Re: Character encoding the copyright symbol

2009-08-06 Thread Robert Dailey
On Aug 6, 11:31 am, Richard Brodie r.bro...@rl.ac.uk wrote: Robert Dailey rcdai...@gmail.com wrote in message news:29ab0981-b95d-4435-91bd-a7a520419...@b15g2000yqd.googlegroups.com... UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in position 1650: character maps

Re: Help with regex

2009-08-06 Thread Robert Dailey
On Aug 6, 11:12 am, Roman atra...@gmail.com wrote: On 06/08/09 08:35, Robert Dailey wrote: Hey guys, I'm creating a python script that is going to try to search a text file for any text that matches my regular expression. The thing it is looking for is: FILEVERSION

Printing with colors in a portable way

2009-07-30 Thread Robert Dailey
Anyone know of a way to print text in Python 3.1 with colors in a portable way? In other words, I should be able to do something like this: print_color( This is my text, COLOR_BLUE ) And this should be portable (i.e. it should work on Linux, Mac, Windows). --

Forwarding keyword arguments

2009-06-23 Thread Robert Dailey
Suppose I have 2 functions like so: def Function2( **extra ): # do stuff def Function1( **extra ): Function2( extra ) As you can see, I would like to forward the additional keyword arguments in variable 'extra' to Function2 from Function1. How can I do this? I'm using Python 3.0.1 --

Re: Forwarding keyword arguments

2009-06-23 Thread Robert Dailey
On Jun 23, 7:34 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Tue, 23 Jun 2009 20:57:36 -0300, Robert Dailey rcdai...@gmail.com   escribió: Suppose I have 2 functions like so: def Function2( **extra ):    # do stuff def Function1( **extra ):    Function2( extra ) As you

Re: urlretrieve() failing on me

2009-06-05 Thread Robert Dailey
On Jun 5, 3:47 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 04 Jun 2009 23:42:29 -0300, Robert Dailey rcdai...@gmail.com   escribió: Hey guys, try using urlretrieve() in Python 3.0.1 on the following URL: http://softlayer.dl.sourceforge.net/sourceforge/wxwindows/wxMSW-2.8.1

Re: urlretrieve() failing on me

2009-06-05 Thread Robert Dailey
On Jun 5, 10:31 am, Peter Otten __pete...@web.de wrote: Robert Dailey wrote: On Jun 5, 3:47 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 04 Jun 2009 23:42:29 -0300, Robert Dailey rcdai...@gmail.com escribió: Hey guys, try using urlretrieve() in Python 3.0.1

Re: urlretrieve() failing on me

2009-06-05 Thread Robert Dailey
On Jun 5, 7:53 pm, Robert Dailey rcdai...@gmail.com wrote: On Jun 5, 10:31 am, Peter Otten __pete...@web.de wrote: Robert Dailey wrote: On Jun 5, 3:47 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 04 Jun 2009 23:42:29 -0300, Robert Dailey rcdai...@gmail.com escribió

Scope objects

2009-06-05 Thread Robert Dailey
Is it possible to create an object in Python that will clean itself up at function exit? I realize destruction of objects may not occur immediately and can be garbage collected, but this functionality would still be great to have. Consider the following function: def do_stuff(): foo =

Re: Scope objects

2009-06-05 Thread Robert Dailey
On Jun 5, 9:07 pm, Chris Rebert c...@rebertia.com wrote: On Fri, Jun 5, 2009 at 6:56 PM, Robert Daileyrcdai...@gmail.com wrote: Is it possible to create an object in Python that will clean itself up at function exit? I realize destruction of objects may not occur immediately and can be

urlretrieve() failing on me

2009-06-04 Thread Robert Dailey
Hey guys, try using urlretrieve() in Python 3.0.1 on the following URL: http://softlayer.dl.sourceforge.net/sourceforge/wxwindows/wxMSW-2.8.10.zip Have it save the ZIP to any destination directory. For me, this only downloads about 40KB before it stops without any error at all. Any reason why

tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
Hi, I'm not a big expert on the tarfile component, but I assumed that .tgz files were short for .tar.gz and the format was the same. When I try to extract a .tgz file using tarfile in Python 3.0 on Windows, I get the following error: File C:\Python30\lib\tarfile.py, line 1630, in open

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:33 am, Robert Dailey rcdai...@gmail.com wrote: Hi, I'm not a big expert on the tarfile component, but I assumed that .tgz files were short for .tar.gz and the format was the same. When I try to extract a .tgz file using tarfile in Python 3.0 on Windows, I get the following

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:49 am, Gary Herron gher...@islandtraining.com wrote: Robert Dailey wrote: Hi, I'm not a big expert on the tarfile component, but I assumed that .tgz files were short for .tar.gz and the format was the same. That's correct. When I try to extract a .tgz file using

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:46 am, Kushal Kumaran kushal.kuma...@gmail.com wrote: On Sat, May 16, 2009 at 10:03 PM, Robert Dailey rcdai...@gmail.com wrote: Hi, I'm not a big expert on the tarfile component, but I assumed that .tgz files were short for .tar.gz and the format was the same. When I try

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:49 am, Gary Herron gher...@islandtraining.com wrote: Robert Dailey wrote: Hi, I'm not a big expert on the tarfile component, but I assumed that .tgz files were short for .tar.gz and the format was the same. That's correct. When I try to extract a .tgz file using

Re: subprocess shared environments

2009-05-04 Thread Robert Dailey
On May 1, 4:18 pm, Aaron Brady castiro...@gmail.com wrote: On May 1, 12:09 am, Robert Dailey rcdai...@gmail.com wrote: I'm currently calling subprocess.call() on a batch file (in Windows) that sets a few environment variables that are needed by further processes started via subprocess.call

subprocess shared environments

2009-05-01 Thread Robert Dailey
I'm currently calling subprocess.call() on a batch file (in Windows) that sets a few environment variables that are needed by further processes started via subprocess.call(). How can I persist the environment modifications by the first call() function? I've done my own searching on this and I came

urlgrabber for Python 3.0

2009-04-30 Thread Robert Dailey
urlgrabber 3.1.0 currently does not support Python 3.0. Is there a version out there that does support this? Perhaps Python 3.0 now has built in support for this? Could someone provide some guidance here? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: RuntimeError: dictionary changed size during iteration

2008-12-09 Thread Robert Dailey
On Dec 8, 10:27 pm, John Machin [EMAIL PROTECTED] wrote: On Dec 9, 3:00 pm, Steven D'Aprano [EMAIL PROTECTED] wrote: On Mon, 08 Dec 2008 19:10:00 -0800, Robert Dailey wrote: On Dec 8, 6:26 pm, Terry Reedy [EMAIL PROTECTED] wrote: Robert Dailey wrote: stuff = vars()   vars

'pretty print' for built in types

2008-12-09 Thread Robert Dailey
Hi, Is there a built in way to 'pretty print' a dict, list, and tuple (Amongst other types)? Dicts probably print the ugliest of them all, and it would be nice to see a way to print them in a readable way. I can come up with my own function to do this, but I don't want to do this if I don't have

Equivalent of 'wget' for python?

2008-12-08 Thread Robert Dailey
Hi, I'm looking for a portable way to download ZIP files on the internet through Python. I don't want to do os.system() to invoke 'wget', since this isn't portable on Windows. I'm hoping the core python library has a library for this. Note that I'll be using Python 3.0. Thanks. --

Calling function from a string

2008-12-08 Thread Robert Dailey
Hi, I have a string representing the name of a function in Python 3.0. How can I call the function name represented by this string *without* creating a mapping? -- http://mail.python.org/mailman/listinfo/python-list

RuntimeError: dictionary changed size during iteration

2008-12-08 Thread Robert Dailey
I'm executing the following code: def CopyBoost( libraries ): pass def CopyEmotionFX( libraries ): pass def Copy( library, aliases ): pass stuff = vars() for key in stuff: print( key, '--', stuff[key] ) I get the following error message: ('CopyEmotionFX', '--', function

Re: RuntimeError: dictionary changed size during iteration

2008-12-08 Thread Robert Dailey
On Dec 8, 6:26 pm, Terry Reedy [EMAIL PROTECTED] wrote: Robert Dailey wrote: stuff = vars()   vars() is globals() True for key in stuff: You just changed globals, which is aliased as stuff. Stuff changes.     print( key, '--', stuff[key] ) I get the following error message

Consequences of importing the same module multiple times in C++?

2008-10-24 Thread Robert Dailey
Hi, I'm currently using boost::python::import() to import Python modules, so I'm not sure exactly which Python API function it is calling to import these files. I posted to the Boost.Python mailing list with this question and they said I'd probably get a better answer here, so here it goes... If

Re: Intercepting printed strings

2008-09-19 Thread Robert Dailey
On Fri, Sep 19, 2008 at 4:21 AM, Gabriel Genellina [EMAIL PROTECTED]wrote: En Thu, 18 Sep 2008 19:24:26 -0300, Robert Dailey [EMAIL PROTECTED] escribió: I'm currently using Python 3.0 b3 and I'm curious as to how I can go about intercepting things send to print() for some intermediate

Intercepting printed strings

2008-09-18 Thread Robert Dailey
Hi, I'm currently using Python 3.0 b3 and I'm curious as to how I can go about intercepting things send to print() for some intermediate processing before they're actually sent to sys.stdout. Right now I've thought of the following: Replace sys.stdout with a class named PrintStream. PrintStream

Calling global functions from a class?

2008-09-06 Thread Robert Dailey
HI, I have the following python script: def __normalizePath( path ): return osp.abspath( osp.normpath( path ) ) class AbsolutePath: def __init__( self, root= ): _root = __normalizePath( root ) When I create an AbsolutePath object, I get the following error: NameError: global

Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
Hi, I find quite often that I'm writing things like this: raise FatalExcept( Insufficient number of arguments specified. Exactly {0} arguments are required. See stage.bat for documentation on accepted parameters..format( num_arguments ) ) On my display (Vertical monitor), this exceeds the width

Re: Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 2:29 PM, Jean-Paul Calderone [EMAIL PROTECTED]wrote: mystring = ( This is a very long string that spans multiple lines and does not include line breaks or tabs from the source file between the strings partitions.) At first glance it looks like this is

Re: Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 3:06 PM, aha [EMAIL PROTECTED] wrote: Can you be more specific? What is the formatting criteria? Are you talking about formatting the string for display or are you talking about the source? Apologies for the confusion. My concern is both. Allow me to explain: I'm

Re: Case-insensitive string compare?

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 12:36 PM, Fredrik Lundh [EMAIL PROTECTED]wrote: Maric Michaud wrote: I suspect you are coming to conclusions a bit quickly, without taking the pain of understanding the whole discussion. I'm pretty sure I was the first one to post an answer in this thread, and I

Re: Need formatting suggestion for long strings

2008-09-05 Thread Robert Dailey
On Fri, Sep 5, 2008 at 3:58 PM, Eric Wertman [EMAIL PROTECTED] wrote: I'm concerned about the formatting of the string in that I do not want the way I split the string up in source code to affect the way the string is displayed to the console. In other words, in source, if I break up a

Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
Hi, I currently have a dictionary object that I'm doing the following with: if lib not in stage_map: # ... do stuff ... However, this will perform a case-sensitive comparison between lib and each key in stage_map. Is there a way to make this do a case-insensitive comparison instead? Yes, I

Re: Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
On Thu, Sep 4, 2008 at 5:14 PM, Robert Dailey [EMAIL PROTECTED] wrote: Hi, I currently have a dictionary object that I'm doing the following with: if lib not in stage_map: # ... do stuff ... However, this will perform a case-sensitive comparison between lib and each key in stage_map

Re: Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
On Thu, Sep 4, 2008 at 5:21 PM, Fredrik Lundh [EMAIL PROTECTED]wrote: Robert Dailey wrote: I currently have a dictionary object that I'm doing the following with: if lib not in stage_map: # ... do stuff ... However, this will perform a case-sensitive comparison between lib and each

Re: Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
On Thu, Sep 4, 2008 at 5:59 PM, Maric Michaud [EMAIL PROTECTED] wrote: Le Friday 05 September 2008 00:47:00 Chris Rebert, vous avez écrit : Then store the string in its original case in the value part of the key-value pair: stage_map[key.lower()] = (key,whatever) premature

How to setup environment for python?

2008-08-25 Thread Robert Dailey
Hi, I'm running on Linux and I'm executing a python script as a subversion post-commit hook. I'm finding that I'm running into a lot of random issues, and I'm guessing this has to do with my environment not being properly setup. From what I've gathered, the environment is not setup when the

What parts of C:\Python25 are important?

2008-08-19 Thread Robert Dailey
Hi, I've currently embedded the python interpreter into a C++ application of mine. I want to bundle the python core library with my application so the user does not have to install python to use my application. What files do I need to copy over? Help is appreciated, thank you. --

Strange return behavior for function

2008-08-05 Thread Robert Dailey
Hi, I've created a function to normalize Subversion URLs, however when I return a string, printing the result of the function becomes None. When I print the value of the string before I return from the function, I see a valid string. What's going on? The function is below: def normurl(

Re: Strange return behavior for function

2008-08-05 Thread Robert Dailey
On Tue, Aug 5, 2008 at 10:05 AM, Robert Dailey [EMAIL PROTECTED] wrote: Hi, I've created a function to normalize Subversion URLs, however when I return a string, printing the result of the function becomes None. When I print the value of the string before I return from the function, I see

Print statement isn't showing up?

2008-08-05 Thread Robert Dailey
Hi, I have the following code: def ReplaceExternalWithCopy( localDir, remoteDir ): print Removing external local directory:, localDir rmdirs( localDir ) vfxrepo.copy( remoteDir, localDir ) I noticed that the print statement above does not show up before vfxrepo.copy() is called.

Password prompt with mask

2008-08-05 Thread Robert Dailey
Hi, I'm looking for something simple that I can use to obtain passwords from the user. Something like input(), but with an option to set the mask character. So if I set it to *, then all the user will see is: ** as they type their password. I know about getpass.getpass(), but I want something

Re: Print statement isn't showing up?

2008-08-05 Thread Robert Dailey
On Tue, Aug 5, 2008 at 2:28 PM, Timothy Grant [EMAIL PROTECTED]wrote: On Tue, Aug 5, 2008 at 9:09 AM, Robert Dailey [EMAIL PROTECTED] wrote: Hi, I have the following code: def ReplaceExternalWithCopy( localDir, remoteDir ): print Removing external local directory:, localDir

os.path.normpath() for URLs?

2008-08-04 Thread Robert Dailey
Hi, I'm currently trying to parse relative URLs, but I want to make them absolute. In other words, I want to normalize the URLs. However, I don't want to have to write this logic myself if it is already provided. I was thinking of somehow tricking os.path.normpath() as a last resort. This is for

Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Robert Dailey
Hi, I want to point out first of all that I'm not as familiar with Python as I should be, and for that reason I question a lot of things because I'm mainly a C++ programmer and I'm used to certain conveniences. Having said that... I've always been curious (more so than annoyed) as to why one

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Robert Dailey
On Wed, Jul 30, 2008 at 1:03 PM, Brett g Porter [EMAIL PROTECTED] wrote: Robert Dailey wrote: This is an example of a response I'm looking for: The self parameter is required because the parser is a bit old and needs to know the exact object you're referencing This is _not_ an example

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Robert Dailey
On Wed, Jul 30, 2008 at 2:46 PM, Matthew Fitzgibbons [EMAIL PROTECTED]wrote: Robert Dailey wrote: On Wed, Jul 30, 2008 at 1:03 PM, Brett g Porter [EMAIL PROTECTED]mailto: [EMAIL PROTECTED] wrote: Robert Dailey wrote: This is an example of a response I'm looking

Re: Reasoning behind 'self' parameter in classes?

2008-07-30 Thread Robert Dailey
On Wed, Jul 30, 2008 at 2:48 PM, Patrick Mullen [EMAIL PROTECTED]wrote: Well, the linked thread gives many reasons, but as mentioned it is a flamewar thread. Philosophically python is not an object oriented language per say, it has an object system, a not bolted on one I might add, but it

Recursive wildcard file search

2008-07-03 Thread Robert Dailey
Hi, Is there a way to perform a recursive file search using wildcards in python 3.0b1? For example, if I have: C:\foo\abc*xyz.* I want all files in C:\foo and all subfolders (recursively) of C:\foo that match the wildcard abc*xyz.* to be matched. In the end, I want a list of files that matched

How to remove read-only from a file

2008-06-06 Thread Robert Dailey
Hi, Using Python 3.0, how can I remove a read-only property from a file in Windows XP? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to remove read-only from a file

2008-06-06 Thread Robert Dailey
On Fri, Jun 6, 2008 at 11:05 AM, Tim Golden [EMAIL PROTECTED] wrote: Robert Dailey wrote: Hi, Using Python 3.0, how can I remove a read-only property from a file in Windows XP? Thanks. import os import stat os.chmod (c:/temp/temp.txt, stat.S_IWRITE) (Haven't actually checked

Where to find Visual Studio Syntax Highlighting (for python)?

2008-06-06 Thread Robert Dailey
Hi, Does anyone know of a way to get syntax coloring working in Visual Studio 2008 for Python? I did some googling but I couldn't find anything. Help is appreciated, thank you. -- http://mail.python.org/mailman/listinfo/python-list

Nested dictionary displays?

2008-06-05 Thread Robert Dailey
Hi, I'm using Python 3.0 (the latest as of now) and I have a very large dictionary that I'm attempting to do some processing on. The dictionary basically has strings in it, as well as other dictionaries which themselves also have strings. Using a display, I'm trying to (with as little code

Re: Continuous Timer

2008-06-03 Thread Robert Dailey
I just need a repeating timer, I could care less about microsecond accuracies. On Tue, Jun 3, 2008 at 11:19 AM, John Nagle [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: En Fri, 30 May 2008 22:50:13 -0300, Robert Dailey [EMAIL PROTECTED] escribió: Reading through the Python 2.5 docs

Continuous Timer

2008-05-30 Thread Robert Dailey
Hi, Reading through the Python 2.5 docs, I'm seeing a Timer class in the threading module, however I cannot find a timer object that will continuously call a function of my choice every amount of milliseconds. For example, every 1000 milliseconds I want a function named Foo to be called.

New python forum on CodeGuru!

2008-03-29 Thread Robert Dailey
Hi, I managed to convince the CodeGuru forum administrator to add a Python discussion forum to the community. It's a great success for me, as I really love CodeGuru and their forums. I really encourage everyone to use it, as it will be a great asset to the Python community. The forum will be

Re: system32 directory

2008-03-07 Thread Robert Dailey
On Fri, Mar 7, 2008 at 2:49 AM, Tim Golden [EMAIL PROTECTED] wrote: Ah. Sorry. I'm sure you can call it via ctypes (built in from Python 2.5). But even if I'd realised that's what you'd wanted, I'd probably have given the original answer because pywin32 pretty much *is* standard library for

Re: system32 directory

2008-03-06 Thread Robert Dailey
On Thu, Mar 6, 2008 at 2:42 AM, Tim Golden [EMAIL PROTECTED] wrote: fishing advice First thing to do when asking How do I do X in Python under Windows? is to stick -- python X -- into Google and you get, eg:

system32 directory

2008-03-05 Thread Robert Dailey
Hi, Is there a way to get the System32 directory from windows through python? For example, in C++ you do this by calling GetSystemDirectory(). Is there an equivalent Python function for obtaining windows installation dependent paths? -- http://mail.python.org/mailman/listinfo/python-list

String compare question

2008-02-25 Thread Robert Dailey
Hi, Currently I have the following code: ignored_dirs = ( r.\boost\include ) if __name__ == __main__: # Walk the directory tree rooted at 'source' for root, dirs, files in os.walk( source ): if root not in ignored_dirs: CopyFiles( root, files, .dll )

Re: String compare question

2008-02-25 Thread Robert Dailey
On Mon, Feb 25, 2008 at 10:49 AM, Gary Herron [EMAIL PROTECTED] wrote: You expect this is creating a tuple (or so I see from your in test in the following code), but in fact the parenthesis do *not* make a tuple. If you look at ignored_dirs, you'll find it's just a string. It's the presence

Re: String compare question

2008-02-25 Thread Robert Dailey
Thanks for your help. I knew of a way to solve this issue, but being a C++ programmer I tend to think of the expanded solutions for things. I wasn't sure if there was a more compact solution for python. Thanks again! On Mon, Feb 25, 2008 at 11:27 AM, Tim Chase [EMAIL PROTECTED] wrote:

python25_d.lib?

2008-02-11 Thread Robert Dailey
Hi, Currently I'm embedding Python 2.5 into my C++ Visual Studio project. However, during the link stage it is stating that it cannot find python25_d.lib. From what I read in my search through Google on this issue is that you actually have to build Python yourself to get a debug version of the

embedding python

2008-02-07 Thread Robert Dailey
Hi, I'm attempting to embed python into my game. What I want to do is the following: 1) Embed the interpreter into my game (Py_Initialize(), etc) using the Python C API 2) Execute modules from my game using the python interpreter (Using boost.python's objects and handles) 3) Expose C++

Re: PLEASE ACCEPT MY SINCERE APOLOGIES

2008-02-01 Thread Robert Dailey
And for top-posting :) That's a matter of opinion ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Will Python on day replace MATLAB?????????????????????????????????????????????????????

2008-02-01 Thread Robert Dailey
This is not part of his Masters... :-) Lmfao -- http://mail.python.org/mailman/listinfo/python-list

Re: C++ version of the C Python API?

2007-10-22 Thread Robert Dailey
On 10/22/07, Nicholas Bastin [EMAIL PROTECTED] wrote: Object-oriented programming is a design choice, not a language feature. You can write straight procedural code in C++, and you can write object oriented code in C. Sure, C++ has some language features which facilitate object-oriented

Re: C++ version of the C Python API?

2007-10-21 Thread Robert Dailey
On 10/21/07, Martin v. Löwis [EMAIL PROTECTED] wrote: Is there a C++ version of the C Python API packaged with python 2.5? Stargaming has already mentioned the fine points; the first answer is: yes, the API packaged python 2.5 can be used with C++. It is a C++ version of the same API as it

Re: C++ version of the C Python API?

2007-10-21 Thread Robert Dailey
On 10/21/07, Martin v. Löwis [EMAIL PROTECTED] wrote: I think you are misinterpreting what you are seeing. The Python C API *is* object-oriented. It has all features of object-orientation: classes, encapsulation, polymorphism, late binding, ... As for make your own: people have tried this

Re: C++ version of the C Python API?

2007-10-21 Thread Robert Dailey
On 10/21/07, Martin v. Löwis [EMAIL PROTECTED] wrote: No, I literally meant that the Python C API is object-oriented. You don't need an object-oriented language to write object-oriented code. I disagree with this statement. C is not an object oriented language, and I've seen attempts to make

Re: Python script for mobile platforms -- suggested?

2007-10-19 Thread Robert Dailey
On 8/14/07, Jay Loden [EMAIL PROTECTED] wrote: XML is first and foremost a machine-parseable language, and a human-readable one second ;) I don't think this is particularly hard to read, but then I work with XML configuration files on a daily basis at work, so I may just be a terrible

__main__ : What is this?

2007-10-19 Thread Robert Dailey
Hi, I've read various portions of the Python 2.5 documentation in an attempt to figure out exactly what the following condition represents: if __name__ == __main__: main() However, I was not able to determine what it is actually checking for. Could someone point me in the way of a tutorial

C++ version of the C Python API?

2007-10-19 Thread Robert Dailey
Hi, Is there a C++ version of the C Python API packaged with python 2.5? It would be nice to have a OOP approach to embedding python in C++. It would also be a bonus if this C++ Python API cleaned up a lot of the messy code involved in embedding python. Thanks. --

Re: Problems with struct.pack()

2007-10-11 Thread Robert Dailey
On 10/11/07, Carsten Haese [EMAIL PROTECTED] wrote: This is much clearer, and it explains why you need to mix arbitrary binary data with unicode text. Because of this mixing, as you have surmised, you're going to have to treat the file as a binary file in Python. In other words, don't open

for loop question

2007-10-10 Thread Robert Dailey
Hi, I'm currently writing my own CSV parser since the built in one doesn't support Unicode. I'm wondering if there's a way to iterate over the characters in a unicode string and have access to both the 'current' and the 'next' characters each iteration. For example: test = uHello World for

Re: for loop question

2007-10-10 Thread Robert Dailey
All the ideas presented here are workable. I definitely have a lot of solutions to choose from. Thanks everyone for your help. I wasn't sure if there was some sort of language feature to naturally do this, so I had to post on the mailing list to make sure. --

Re: for loop question

2007-10-10 Thread Robert Dailey
' in the range of range(128) or something (Not really an expert on Unicode so I'm not sure of the meaning). I would use CSV if I could! On 10/10/07, Carsten Haese [EMAIL PROTECTED] wrote: On Wed, 2007-10-10 at 15:27 -0500, Robert Dailey wrote: I'm using CSV for localization in a game I'm involved

Re: for loop question

2007-10-10 Thread Robert Dailey
On 10/10/07, Carsten Haese [EMAIL PROTECTED] wrote: Instead of passing the file object directly to the csv parser, pass in a generator that reads from the file and explicitly encodes the strings into UTF-8, along these lines: def encode_to_utf8(f): for line in f: yield

How to dereference an iterator?

2007-10-10 Thread Robert Dailey
Hi, Suppose I wanted to manually iterate over a container, for example: mylist = [1,2,3,4,5,6] it = iter(mylist) while True: print it it.next() In the example above, the print doesn't print the VALUE that the iterator currently represents, it prints the iterator itself. How can I get

  1   2   >