Thanks for the help everyone (especially those that gave more answers
than attitude). It's working perfectly!
Ian
--
http://mail.python.org/mailman/listinfo/python-list
On 25 Jan 2006 12:42:20 -0800, "IamIan" <[EMAIL PROTECTED]> wrote:
>Thank you for the replies, I'm new to Python and appreciate your
>patience. I'm using Python 2.1.
>
>To reiterate, the ASCII files in the workspace are being read correctly
>and their latitude values (coming from the filenames) ar
On Thu, 26 Jan 2006 06:39:20 GMT in comp.lang.python, Dennis Lee
Bieber <[EMAIL PROTECTED]> wrote:
>On 25 Jan 2006 12:42:20 -0800, "IamIan" <[EMAIL PROTECTED]> declaimed the
>following in comp.lang.python:
[...]
>> I tried print repr(filename) and it returned the actual filename:
>> 'n16w099.asc'
On Wed, 25 Jan 2006 16:57:47 -0800, IamIan wrote:
>>Dude. You're trying to add a string to an int. What did you think would
>>happen?
>
> Dude. I thought it would concatenate the value for LatInt with the rest
> of the sentence; I wasn't literally trying to add them. Apparently you
> can only con
>Dude. You're trying to add a string to an int. What did you think would
>happen?
Dude. I thought it would concatenate the value for LatInt with the rest
of the sentence; I wasn't literally trying to add them. Apparently you
can only concatenate strings like this in Python.
--
http://mail.python
On Wed, 25 Jan 2006 12:42:20 -0800, IamIan wrote:
> Thank you for the replies, I'm new to Python and appreciate your
> patience. I'm using Python 2.1.
>
> To reiterate, the ASCII files in the workspace are being read correctly
> and their latitude values (coming from the filenames) are successful
Thank you for the replies, I'm new to Python and appreciate your
patience. I'm using Python 2.1.
To reiterate, the ASCII files in the workspace are being read correctly
and their latitude values (coming from the filenames) are successfully
being converted to string. Even doing LatInt = int(LatStri
On 24 Jan 2006 10:44:32 -0800, "IamIan" <[EMAIL PROTECTED]> wrote:
>I searched the archives but couldn't find anyone else with this
>problem. Basically I'm grabbing all ASCII files in a directory and
>doing geoprocessing on them. I need to calculate a z-factor based on
>the latitude of the ASCII f
"IamIan" <[EMAIL PROTECTED]> wrote:
> The exception I get is "TypeError: Cannot add value 'int' to string."
now that you've posted the exception, can you please post the code
you're using, and the *complete* traceback.
(the stuff you posted earlier contained syntax errors, and didn't con-
tain a
The exception I get is "TypeError: Cannot add value 'int' to string." I
have looked at LatString, and it is the string representation of
latitude ('17' etc.). What's odd is that the exception is raised not
when I include LatInt = int(LatString), but when I try to print
LatInt's value or multiply it
At lest one of the filenames (or directories) being returned by
os.listdir doesn't have integer value where you are looking.
Remember that os.listdir returns subdirectories as well as files.
You may want to look at using glob.glob() instead and limit it
to *.asc.
Secondly,
filenames = [filename.l
First: http://www.catb.org/~esr/faqs/smart-questions.html
You say your program 'crashes' when it gets to 'int(LatString)'. I'm
guessing (and it's entirely a guess, since you don't tell us) that you
are getting an exception like 'ValueError: invalid literal for int():
whatever'. I'm guessing agai
I searched the archives but couldn't find anyone else with this
problem. Basically I'm grabbing all ASCII files in a directory and
doing geoprocessing on them. I need to calculate a z-factor based on
the latitude of the ASCII file being worked on, which is in the
filename. If I type in the code man
13 matches
Mail list logo