global variables and local functions.

Micah Mayo astrophels at yahoo.com
Thu Aug 29 06:11:31 CEST 2002


Mark McEahern wrote:
> [Micah Mayo]
> 
>>Basically here's what I'm trying to do:
>><pseudocode>
> 
> ...
> 
>>list1 = []
>>list2 = []
>>global_int = 0
> 
> 
> I'm sorry, but I find it hard to follow pseudocode and intuit how that's
> related to the real error you're getting.
> 
okay,

sourcePath = []
destPath = []
mlistLen = 0

populateLists():
	textFile = open('movelist')
	for eachLine in textFile.readlines():
		source, dest = eachLine.split()
		sourcePath.append(source)
		destPath.append(dest)
		mlistLen += 1

moveFiles():
	for x in range(mlistLen):
		shutil.copy2(sourcePath[x],destPath[x])
		
So, that's the part that doesn't work almost line for line.
> Please do the hard work of posting a complete but abbreviated version of
> your code that actually generates the error you're seeing.  Chances are,
> you'll solve your own problem in the process.
> 
> There's a reason people eschew global variables, by the way.  <wink>
Which is? I've been programming since Monday, so I'm pretty new at this. :)

Thanks,
Micah
> 
> Cheers,
> 
> // mark
> 
> -
> 
> 




More information about the Python-list mailing list