Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29220 > unrolled thread

cannot concatenate 'str' and 'list' objects

Started byΝικόλαος Κούρας <nikos.gr33k@gmail.com>
First post2012-09-15 05:22 -0700
Last post2012-09-16 01:46 +1000
Articles 20 on this page of 43 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 05:22 -0700
    Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 05:26 -0700
    Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-15 22:33 +1000
      Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:28 -0700
        Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-15 23:38 +1000
          Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:53 -0700
            Re: cannot concatenate 'str' and 'list' objects Peter Otten <__peter__@web.de> - 2012-09-15 16:29 +0200
              Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:51 -0700
                Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 00:55 +1000
              Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:51 -0700
          Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:53 -0700
            Re: cannot concatenate 'str' and 'list' objects Roy Smith <roy@panix.com> - 2012-09-15 10:21 -0400
              Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:44 -0700
                Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 00:49 +1000
                Re: cannot concatenate 'str' and 'list' objects Roy Smith <roy@panix.com> - 2012-09-15 11:01 -0400
                  Re: cannot concatenate 'str' and 'list' objects Chris Gonnerman <chris@gonnerman.org> - 2012-09-15 11:09 -0500
      Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:28 -0700
    Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:56 -0700
    Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:01 -0700
    Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:06 -0700
      Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 01:23 +1000
    Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:23 -0700
      Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 01:44 +1000
        Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:04 -0700
          Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 02:25 +1000
            Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:53 -0700
              Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 02:56 +1000
                Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:22 -0700
                  Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:26 -0700
                    Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 03:42 +1000
                      Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:59 -0700
                        Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 04:02 +1000
                          Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 11:10 -0700
                            Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 09:11 +1000
                          Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 11:10 -0700
                      Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:59 -0700
                  Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:26 -0700
                Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:22 -0700
            Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:53 -0700
        Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:04 -0700
      Re: cannot concatenate 'str' and 'list' objects Chris Gonnerman <chris@gonnerman.org> - 2012-09-15 11:13 -0500
    Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:33 -0700
      Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 01:46 +1000

Page 1 of 3  [1] 2 3  Next page →


#29220 — cannot concatenate 'str' and 'list' objects

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 05:22 -0700
Subjectcannot concatenate 'str' and 'list' objects
Message-ID<071ad036-77ca-42d3-b68d-0dd3e3fac43e@googlegroups.com>
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')

[toc] | [next] | [standalone]


#29221

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 05:26 -0700
Message-ID<0e4c9353-f744-4ef1-9ff4-6a04a86a832b@googlegroups.com>
In reply to#29220
Sorry the problem appears when you try to input data botton down the page in the text area boxes and click submit.

this is the error apperaing:

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 /home/nikos/public_html/cgi-bin/counter.py in ()
   56 # I would suggest using some kind of verification function to check that the value of 'page' is OK, before opening the file.
   57 
   58 f = open( '../' + page )
   59 
   60 # read first line of the file
f undefined, builtin open = <built-in function open>, page = ['index.html', 'index.html']
<type 'exceptions.TypeError'>: cannot concatenate 'str' and 'list' objects 
      args = ("cannot concatenate 'str' and 'list' objects",) 
      message = "cannot concatenate 'str' and 'list' objects"

[toc] | [prev] | [next] | [standalone]


#29222

FromChris Angelico <rosuav@gmail.com>
Date2012-09-15 22:33 +1000
Message-ID<mailman.746.1347712435.27098.python-list@python.org>
In reply to#29220
On Sat, Sep 15, 2012 at 10:22 PM, Νικόλαος Κούρας <nikos.gr33k@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

[toc] | [prev] | [next] | [standalone]


#29224

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 06:28 -0700
Message-ID<2138d293-c411-404d-bbf1-1afbae3fc597@googlegroups.com>
In reply to#29222
Τη Σάββατο, 15 Σεπτεμβρίου 2012 3:34:34 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Sat, Sep 15, 2012 at 10:22 PM, Νικόλαος Κούρας <nikos.gr33k@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?

[toc] | [prev] | [next] | [standalone]


#29225

FromChris Angelico <rosuav@gmail.com>
Date2012-09-15 23:38 +1000
Message-ID<mailman.748.1347716291.27098.python-list@python.org>
In reply to#29224
On Sat, Sep 15, 2012 at 11:28 PM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
> 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?

f = open( '../' + page[0])

will possibly work. But do try to understand what's happening, rather
than simply solve the problem. You may find that something else has
changed too.

ChrisA

[toc] | [prev] | [next] | [standalone]


#29227

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 06:53 -0700
Message-ID<da8c796d-3986-4c14-898d-37d82906ea91@googlegroups.com>
In reply to#29225
Τη Σάββατο, 15 Σεπτεμβρίου 2012 4:38:51 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Sat, Sep 15, 2012 at 11:28 PM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
> 
> > 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?
> 
> 
> 
> f = open( '../' + page[0])
> 
> 
> 
> will possibly work. But do try to understand what's happening, rather
> 
> than simply solve the problem. You may find that something else has
> 
> changed too.
> 
> 
> 
> ChrisA

i see you try to extract only the 1st element of the list, i tried that too but it gives me now this weird message:

if you visit my website http://superhost.gr

[toc] | [prev] | [next] | [standalone]


#29232

FromPeter Otten <__peter__@web.de>
Date2012-09-15 16:29 +0200
Message-ID<mailman.752.1347719347.27098.python-list@python.org>
In reply to#29227
Νικόλαος Κούρας wrote:

> Τη Σάββατο, 15 Σεπτεμβρίου 2012 4:38:51 μ.μ. UTC+3, ο χρήστης Chris
> Angelico έγραψε:
>> On Sat, Sep 15, 2012 at 11:28 PM, Νικόλαος Κούρας <nikos.gr33k@gmail.com>
>> wrote:
>> 
>> > 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?
>> 
>> 
>> 
>> f = open( '../' + page[0])
>> 
>> 
>> 
>> will possibly work. But do try to understand what's happening, rather
>> 
>> than simply solve the problem. You may find that something else has
>> 
>> changed too.
>> 
>> 
>> 
>> ChrisA
> 
> i see you try to extract only the 1st element of the list, i tried that
> too but it gives me now this weird message:
> 
> if you visit my website http://superhost.gr

You seem to have encoding problems:

>>> print '\xc4\xe5\xed \xf5\xf0\xdc\xf1\xf7\xe5\xe9 
\xf4\xdd\xf4\xef\xe9\xef \xe1\xf1\xf7\xe5\xdf\xef \xde 
\xea\xe1\xf4\xdc\xeb\xef\xe3\xef\xf2'.decode("iso-8859-7")
Δεν υπάρχει τέτοιο αρχείο ή κατάλογος

That doesn't look weird (I'd guess) for someone who knows Greek...

Proceeding to

http://superhost.gr/cgi-bin/counter.py?page=foo.html

versus

http://superhost.gr/cgi-bin/counter.py?page=foo.html&page=bar.html

it turns out that you get a list as the page variable only in the latter 
case. So you might have provoked your initial problem by following a buggy 
url with a duplicate page argument.

[toc] | [prev] | [next] | [standalone]


#29235

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 07:51 -0700
Message-ID<2c37aa2e-10fb-4e34-ad40-8f16b612e369@googlegroups.com>
In reply to#29232
in my case an .htaccess file gives redirects all html requests to /cgi-bin/counter.py by also provide as an argument to the counter.py script the initical html file request

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?page=$1 [L,PT,QSA]

so the latter you mentioned its not the case for me.
But iam wondering why this doesnt work on this server while on my previous host did.....

[toc] | [prev] | [next] | [standalone]


#29237

FromChris Angelico <rosuav@gmail.com>
Date2012-09-16 00:55 +1000
Message-ID<mailman.755.1347720959.27098.python-list@python.org>
In reply to#29235
On Sun, Sep 16, 2012 at 12:51 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
> in my case an .htaccess file gives redirects all html requests to /cgi-bin/counter.py by also provide as an argument to the counter.py script the initical html file request
>
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} -f
> RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?page=$1 [L,PT,QSA]
>
> so the latter you mentioned its not the case for me.
> But iam wondering why this doesnt work on this server while on my previous host did.....

Okay, now we're getting to a possible difference. Check if this is
properly working; perhaps HostGator don't let you use the rewrite
engine in .htaccess. Make sure your .htaccess is in the right
directory, too. I just tried a quick check and was greeted with a 404
page, so the rule you describe isn't active.

ChrisA

[toc] | [prev] | [next] | [standalone]


#29236

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 07:51 -0700
Message-ID<mailman.754.1347720685.27098.python-list@python.org>
In reply to#29232
in my case an .htaccess file gives redirects all html requests to /cgi-bin/counter.py by also provide as an argument to the counter.py script the initical html file request

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?page=$1 [L,PT,QSA]

so the latter you mentioned its not the case for me.
But iam wondering why this doesnt work on this server while on my previous host did.....

[toc] | [prev] | [next] | [standalone]


#29228

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 06:53 -0700
Message-ID<mailman.750.1347717221.27098.python-list@python.org>
In reply to#29225
Τη Σάββατο, 15 Σεπτεμβρίου 2012 4:38:51 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Sat, Sep 15, 2012 at 11:28 PM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
> 
> > 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?
> 
> 
> 
> f = open( '../' + page[0])
> 
> 
> 
> will possibly work. But do try to understand what's happening, rather
> 
> than simply solve the problem. You may find that something else has
> 
> changed too.
> 
> 
> 
> ChrisA

i see you try to extract only the 1st element of the list, i tried that too but it gives me now this weird message:

if you visit my website http://superhost.gr

[toc] | [prev] | [next] | [standalone]


#29231

FromRoy Smith <roy@panix.com>
Date2012-09-15 10:21 -0400
Message-ID<roy-261B6D.10212015092012@news.panix.com>
In reply to#29228
In article <mailman.750.1347717221.27098.python-list@python.org>,

> i see you try to extract only the 1st element of the list, i tried that too 
> but it gives me now this weird message:
> 
> if you visit my website http://superhost.gr

Do you realize that the hosting service you're using (HostGator) is so 
mis-configured that it is exposing your source code and credentials to 
the entire world?

When I go to that URL, I get a page which includes the name of the CGI 
script you are running (/home/nikos/public_html/cgi-bin/counter.py).  I 
can then do a GET on http://superhost.gr/~nikos/cgi-bin/counter.py, and 
can see your script source code, including the credentials to attach to 
your database:

conn = MySQLdb.connect( db = 'nikos_tech', host = 'localhost', user = 
'nikos_nikos', passwd = <elided>)

How to properly configure a web server is way beyond the scope of this 
mailing list, but you really need to do some research there to safeguard 
your own data.

[toc] | [prev] | [next] | [standalone]


#29233

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 07:44 -0700
Message-ID<dc558687-9ae1-4dab-aa82-422b069f7cfa@googlegroups.com>
In reply to#29231
Τη Σάββατο, 15 Σεπτεμβρίου 2012 5:21:22 μ.μ. UTC+3, ο χρήστης Roy Smith έγραψε:
> In article <mailman.750.1347717221.27098.python-list@python.org>,
> 
> 
> 
> > i see you try to extract only the 1st element of the list, i tried that too 
> 
> > but it gives me now this weird message:
> 
> > 
> 
> > if you visit my website http://superhost.gr
> 
> 
> 
> Do you realize that the hosting service you're using (HostGator) is so 
> 
> mis-configured that it is exposing your source code and credentials to 
> 
> the entire world?
> 
> 
> 
> When I go to that URL, I get a page which includes the name of the CGI 
> 
> script you are running (/home/nikos/public_html/cgi-bin/counter.py).  I 
> 
> can then do a GET on http://superhost.gr/~nikos/cgi-bin/counter.py, and 
> 
> can see your script source code, including the credentials to attach to 
> 
> your database:
> 
> 
> 
> conn = MySQLdb.connect( db = 'nikos_tech', host = 'localhost', user = 
> 
> 'nikos_nikos', passwd = <elided>)
> 
> 
> 
> How to properly configure a web server is way beyond the scope of this 
> 
> mailing list, but you really need to do some research there to safeguard 
> 
> your own data.

I cant beleive that my source code can be seen form ANYONE this easily!!!!

I moved to HostGaot because i heard there were the best in the hosting business.....

[toc] | [prev] | [next] | [standalone]


#29234

FromChris Angelico <rosuav@gmail.com>
Date2012-09-16 00:49 +1000
Message-ID<mailman.753.1347720567.27098.python-list@python.org>
In reply to#29233
On Sun, Sep 16, 2012 at 12:44 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
> Τη Σάββατο, 15 Σεπτεμβρίου 2012 5:21:22 μ.μ. UTC+3, ο χρήστης Roy Smith έγραψε:
>> Do you realize that the hosting service you're using (HostGator) is so
>> mis-configured that it is exposing your source code and credentials to
>> the entire world?
>
> I cant beleive that my source code can be seen form ANYONE this easily!!!!
>
> I moved to HostGaot because i heard there were the best in the hosting business.....

It's probably a simple misconfiguration that can be easily fixed. If
you don't yourself understand it, talk to HostGator support;
presumably you're paying them money for hosting, so they should be
both able and willing to help you sort that out.

I would recommend that you change your database password as soon as
that's done, lest someone "seize the day" and take control of your
database.

ChrisA

[toc] | [prev] | [next] | [standalone]


#29240

FromRoy Smith <roy@panix.com>
Date2012-09-15 11:01 -0400
Message-ID<roy-E3F30D.11013215092012@news.panix.com>
In reply to#29233
In article <dc558687-9ae1-4dab-aa82-422b069f7cfa@googlegroups.com>,
 Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:

> I cant beleive that my source code can be seen form ANYONE this easily!!!!

Which is why I pointed it out.  I mean no disrespect, but you appear to 
be in over your head.  That's fine (we're all in over our heads at some 
point, that's how we learn new things), but once you're running a server 
on the Internet, the consequences of your actions become much more 
severe.

> I moved to HostGaot because i heard there were the best in the hosting 
> business.....

The hosting business means different things to different people.  At one 
end, there's places like WordPress and Tumblr which hide all the details 
and let you pour content into a blog with some control over styling.  At 
the other end, there's places like AWS, Rackspace, etc, which give you a 
raw (virtual) machine, and you're free to do anything you want on it.

In between, there's paces like HostGator, which give you a slice of a 
shared host, and you're free to install cgi scripts under the control of 
Apache.  How much you get to play with the Apache configuration probably 
varies wildly from provider to provider.  It looks like HostGator either 
has things mis-configured to allow your /cgi-bin directory to be 
visible, or allows you the ability to configure those things yourself, 
and you mis-configured it.

[toc] | [prev] | [next] | [standalone]


#29249

FromChris Gonnerman <chris@gonnerman.org>
Date2012-09-15 11:09 -0500
Message-ID<mailman.760.1347725773.27098.python-list@python.org>
In reply to#29240
> I moved to HostGaot because i heard there were the best in the hosting
> business.....
They are pretty good.  However, you have to understand the site layout 
to do CGI safely.

So long as your script are .cgi, putting them in ~/public_html is fine.  
If you need to deploy .py files, you need to put them in a different 
folder outside ~/public_html, for example ~/lib or ~/python, then in 
your CGI scripts you need to add that to the path.

For example:

#!/usr/bin/python

import sys
sys.path.append("../python")

import MyModule, MyPackage.OtherModule

This is more or less how all my CGI scripts on HostGator are done.

-- Chris.

[toc] | [prev] | [next] | [standalone]


#29226

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 06:28 -0700
Message-ID<mailman.749.1347716375.27098.python-list@python.org>
In reply to#29222
Τη Σάββατο, 15 Σεπτεμβρίου 2012 3:34:34 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Sat, Sep 15, 2012 at 10:22 PM, Νικόλαος Κούρας <nikos.gr33k@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?

[toc] | [prev] | [next] | [standalone]


#29238

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 07:56 -0700
Message-ID<1ddffea4-576f-45c6-beaa-04966f024ae3@googlegroups.com>
In reply to#29220
Thank i will do that, ill inform the support right away!

[toc] | [prev] | [next] | [standalone]


#29239

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 08:01 -0700
Message-ID<aeef9035-eab9-40ee-8b00-347c247bd921@googlegroups.com>
In reply to#29220
The .htaccess file works with HostGator because the page was working all day rediecting all html requests fine to the counter.py script.

Only when i tried to post data to the text area boxes this problem made its appearance.

[toc] | [prev] | [next] | [standalone]


#29241

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 08:06 -0700
Message-ID<181f1ff8-0f25-48d3-9265-1c2afef7f95b@googlegroups.com>
In reply to#29220
Previous webhost has the same flaw as well, look:

http://www.errorweb.gr/~nikos/cgi-bin/

giving away all my scripts.

Webhost misconfiguration in both hosts!

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.lang.python


csiph-web