cannot concatenate 'str' and 'list' objects

Сахнов Михаил sahnov.m at gmail.com
Sat Sep 15 09:33:51 EDT 2012


f = open( '../' + page.pop() )
15.09.2012 17:32 пользователь "Νικόλαος Κούρας" <nikos.gr33k at gmail.com>
написал:

> Τη Σάββατο, 15 Σεπτεμβρίου 2012 3:34:34 μ.μ. UTC+3, ο χρήστης Chris
> Angelico έγραψε:
> > 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
>
> Iam not using frameworks just plain python code written in Notepad++
>
> Can you please tell me how to switch this line in order for this line to
> work?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120915/a26d4464/attachment.html>


More information about the Python-list mailing list