cannot concatenate 'str' and 'list' objects

Chris Angelico rosuav at gmail.com
Sat Sep 15 08:33:52 EDT 2012


On Sat, Sep 15, 2012 at 10:22 PM, Νικόλαος Κούρας <nikos.gr33k at gmail.com> wrote:
> Hello,
>
> I recently changed webhost and in the new one iam getting this error you can see if you visit http://superhost.gr when program execution reaches the line:
>
>    f = open( '../' + page )
>
> In the previous host i wasn't getting this error.
>
> page's contents is:
>
> page = form.getvalue('page')

Well, clearly '../' is a string (str), and page must be a list. But
without knowing your web framework it's hard to be sure what's going
on.

My guess is that form.getvalue() is returning a list of form elements
with that name, so you have a list with one element in it. But check
your documentation to be sure.

Since this changed when you changed hosts, it may mean you now have a
completely different framework. Possibly you can configure this.
Alternatively, it may simply be a different version of the same
system. It's hard to know just based on this, though.

ChrisA



More information about the Python-list mailing list