HelloWorld - AttributeError 'typle' object jas no attribute 'startswith'

[email protected] Wed, 24 Apr 2019 07:01:41 -0700 (PDT)
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
------=_Part_785_611265392.1556114501204
Content-Type: multipart/alternative; 
	boundary="----=_Part_786_1385113630.1556114501205"

------=_Part_786_1385113630.1556114501205
Content-Type: text/plain; charset="UTF-8"

Hi all,

I am getting a HelloWorld application up and running and it was working 
fine.
I then wanted to move the server/application configuration settings to a 
.conf file, but no I am getting a very weird error.

*error*
 python3.5m main.py

[24/Apr/2019:15:59:48] ENGINE Listening for SIGHUP.
[24/Apr/2019:15:59:48] ENGINE Listening for SIGTERM.
[24/Apr/2019:15:59:48] ENGINE Listening for SIGUSR1.
[24/Apr/2019:15:59:48] ENGINE Bus STARTING
[24/Apr/2019:15:59:48] ENGINE Error in 'start' listener 
<cherrypy._cpchecker.Checker object at 0x75fe41b0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/cherrypy/process/wspbus.py", 
line 230, in publish
    output.append(listener(*args, **kwargs))
  File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cpchecker.py", 
line 40, in __call__
    method()
  File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cpchecker.py", 
line 144, in check_static_paths
    if os.path.isabs(dir):
  File "/usr/lib/python3.5/posixpath.py", line 64, in isabs
    return s.startswith(sep)
*AttributeError: 'tuple' object has no attribute 'startswith'*

[24/Apr/2019:15:59:48] ENGINE Started monitor thread 'Autoreloader'.
[24/Apr/2019:15:59:49] ENGINE Serving on http://0.0.0.0:8080


*main.py*
import os, os.path
import cherrypy


class HelloWorld(object):
       @cherrypy.expose
       def index(self):
               return "Hello World !"


        @cherrypy.expose
       def greet(self, name='Unknown'):
               return "Hello " + name + " !"


if __name__ == '__main__':
       cherrypy.quickstart(HelloWorld(), '/', 'main.conf')

*main.conf*
*[global]*
*server.socket_host = '0.0.0.0'*
*server.socket_port = 8080*
*log.access_file = ''*
*log.error_file = ''*

*[/]*
*tools.trailing_slash.on = False*
*tools.staticdir.root = os.path.abspath(os.getcwd())*

*[/html]*
*tools.staticdir.on = True*
*tools.staticdir.dir = './html',*
*tools.staticdir.index = 'index.html'*

*[/css]*
*tools.staticdir.on = True*
*tools.staticdir.dir = './css'*


If I remove everything from main.conf after [global], then the server 
starts.
But as soon as I add [/] and on then I get the error.

Any ideas / help ?

Thanks !!

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.

------=_Part_786_1385113630.1556114501205
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi all,<div><br></div><div>I am getting a HelloWorld appli=
cation up and running and it was working fine.</div><div>I then wanted to m=
ove the server/application configuration settings to a .conf file, but no I=
 am getting a very weird error.</div><div><br></div><div><b>error</b></div>=
<div><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 25=
0); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1p=
x; overflow-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><div class=3D"subprettyprint"><font color=3D"#660066">=C2=A0p=
ython3.5m main.py<br><br></font></div><div class=3D"subprettyprint"><font c=
olor=3D"#660066">[24/Apr/2019:15:59:48] ENGINE Listening for SIGHUP.</font>=
</div><div class=3D"subprettyprint"><font color=3D"#660066">[24/Apr/2019:15=
:59:48] ENGINE Listening for SIGTERM.</font></div><div class=3D"subprettypr=
int"><font color=3D"#660066">[24/Apr/2019:15:59:48] ENGINE Listening for SI=
GUSR1.</font></div><div class=3D"subprettyprint"><font color=3D"#660066">[2=
4/Apr/2019:15:59:48] ENGINE Bus STARTING</font></div><div class=3D"subprett=
yprint"><font color=3D"#660066">[24/Apr/2019:15:59:48] ENGINE Error in &#39=
;start&#39; listener &lt;cherrypy._cpchecker.Checker object at 0x75fe41b0&g=
t;</font></div><div class=3D"subprettyprint"><font color=3D"#660066">Traceb=
ack (most recent call last):</font></div><div class=3D"subprettyprint"><fon=
t color=3D"#660066">=C2=A0 File &quot;/usr/local/lib/python3.5/dist-package=
s/cherrypy/process/wspbus.py&quot;, line 230, in publish</font></div><div c=
lass=3D"subprettyprint"><font color=3D"#660066">=C2=A0 =C2=A0 output.append=
(listener(*args, **kwargs))</font></div><div class=3D"subprettyprint"><font=
 color=3D"#660066">=C2=A0 File &quot;/usr/local/lib/python3.5/dist-packages=
/cherrypy/_cpchecker.py&quot;, line 40, in __call__</font></div><div class=
=3D"subprettyprint"><font color=3D"#660066">=C2=A0 =C2=A0 method()</font></=
div><div class=3D"subprettyprint"><font color=3D"#660066">=C2=A0 File &quot=
;/usr/local/lib/python3.5/dist-packages/cherrypy/_cpchecker.py&quot;, line =
144, in check_static_paths</font></div><div class=3D"subprettyprint"><font =
color=3D"#660066">=C2=A0 =C2=A0 if os.path.isabs(dir):</font></div><div cla=
ss=3D"subprettyprint"><font color=3D"#660066">=C2=A0 File &quot;/usr/lib/py=
thon3.5/posixpath.py&quot;, line 64, in isabs</font></div><div class=3D"sub=
prettyprint"><font color=3D"#660066">=C2=A0 =C2=A0 return s.startswith(sep)=
</font></div><div class=3D"subprettyprint"><font color=3D"#660066"><b>Attri=
buteError: &#39;tuple&#39; object has no attribute &#39;startswith&#39;</b>=
</font></div><div class=3D"subprettyprint"><font color=3D"#660066"><br></fo=
nt></div><div class=3D"subprettyprint"><font color=3D"#660066">[24/Apr/2019=
:15:59:48] ENGINE Started monitor thread &#39;Autoreloader&#39;.</font></di=
v><div class=3D"subprettyprint"><font color=3D"#660066">[24/Apr/2019:15:59:=
49] ENGINE Serving on http://0.0.0.0:8080</font></div><div><br></div></div>=
</code></div><br><b>main.py</b><br></div><div><div style=3D""><div class=3D=
"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: =
rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: =
break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><div=
 style=3D"font-family: Arial, Helvetica, sans-serif; background-color: rgb(=
255, 255, 255);"><span style=3D"color: #008;" class=3D"styled-by-prettify">=
import</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> os<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> os</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">path</span></div><div style=3D"font-=
family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);=
"><span style=3D"color: #000;" class=3D"styled-by-prettify">import cherrypy=
<br></span></div><div style=3D"font-family: Arial, Helvetica, sans-serif; b=
ackground-color: rgb(255, 255, 255);"><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span></div><div style=3D"font-family: Arial, Hel=
vetica, sans-serif; background-color: rgb(255, 255, 255);"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span></div><div style=3D"fo=
nt-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 25=
5);"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #606;" class=3D"styled-by-prettify">HelloWorld</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">object</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">):</span></div><div style=3D"font-famil=
y: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=
=A0 =C2=A0</span><span style=3D"color: #066;" class=3D"styled-by-prettify">=
@cherrypy</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">expose</sp=
an></div><div style=3D"font-family: Arial, Helvetica, sans-serif; backgroun=
d-color: rgb(255, 255, 255);"><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">def</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> index</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">self</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">):</span></div><div style=3D"font-family: Arial, Helvetica, sans-serif=
; background-color: rgb(255, 255, 255);"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0</span><span style=3D"color: #008;" class=3D"styled-by-prettify">retu=
rn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;Hello World=
 !&quot;</span></div><div style=3D"font-family: Arial, Helvetica, sans-seri=
f; background-color: rgb(255, 255, 255);"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span></div><div style=3D"font-family: Arial,=
 Helvetica, sans-serif; background-color: rgb(255, 255, 255);"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div><div style=
=3D"font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 2=
55, 255);"><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #066;" class=3D"styled-b=
y-prettify">@cherrypy</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">expose</span></div><div style=3D"font-family: Arial, Helvetica, sans-seri=
f; background-color: rgb(255, 255, 255);"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">def</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> greet</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">self</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> name</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">=3D</span><span style=3D"color: #080;" class=3D"styled-by-prettify">&#3=
9;Unknown&#39;</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">):</span></div><div style=3D"font-family: Arial, Helvetica, sans-serif;=
 background-color: rgb(255, 255, 255);"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0</span><span style=3D"color: #008;" class=3D"styled-by-prettify">retu=
rn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;Hello &quot=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">+</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> name </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">+</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" cla=
ss=3D"styled-by-prettify">&quot; !&quot;</span></div><div style=3D"font-fam=
ily: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div><=
div style=3D"font-family: Arial, Helvetica, sans-serif; background-color: r=
gb(255, 255, 255);"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span></div><div style=3D"font-family: Arial, Helvetica, sans-serif=
; background-color: rgb(255, 255, 255);"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">if</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> __name__ </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettif=
y">&#39;__main__&#39;</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">:</span></div><div style=3D"font-family: Arial, Helvetica, sans-=
serif; background-color: rgb(255, 255, 255);"><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0cherrypy</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">quickstart</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">HelloWorld</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(),</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&#39;/&#39;</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pre=
ttify">&#39;main.conf&#39;</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span></div></div></code></div><br><b>main.conf</b></div></div>=
<div style=3D""><div class=3D"prettyprint" style=3D"background-color: rgb(2=
50, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; borde=
r-width: 1px; overflow-wrap: break-word;"><code class=3D"prettyprint" style=
=3D""><div class=3D"subprettyprint" style=3D""><div class=3D"subprettyprint=
" style=3D""><font color=3D"#660066"><b>[global]</b></font></div><div class=
=3D"subprettyprint" style=3D""><font color=3D"#660066"><b>server.socket_hos=
t =3D &#39;0.0.0.0&#39;</b></font></div><div class=3D"subprettyprint" style=
=3D""><font color=3D"#660066"><b>server.socket_port =3D 8080</b></font></di=
v><div class=3D"subprettyprint" style=3D""><font color=3D"#660066"><b>log.a=
ccess_file =3D &#39;&#39;</b></font></div><div class=3D"subprettyprint" sty=
le=3D""><font color=3D"#660066"><b>log.error_file =3D &#39;&#39;</b></font>=
</div><div class=3D"subprettyprint" style=3D""><font color=3D"#660066"><b><=
br></b></font></div><div class=3D"subprettyprint" style=3D""><font color=3D=
"#660066"><b>[/]</b></font></div><div class=3D"subprettyprint" style=3D""><=
font color=3D"#660066"><b>tools.trailing_slash.on =3D False</b></font></div=
><div class=3D"subprettyprint" style=3D""><font color=3D"#660066"><b>tools.=
staticdir.root =3D os.path.abspath(os.getcwd())</b></font></div><div class=
=3D"subprettyprint" style=3D""><font color=3D"#660066"><b><br></b></font></=
div><div class=3D"subprettyprint" style=3D""><font color=3D"#660066"><b>[/h=
tml]</b></font></div><div class=3D"subprettyprint" style=3D""><font color=
=3D"#660066"><b>tools.staticdir.on =3D True</b></font></div><div class=3D"s=
ubprettyprint" style=3D""><font color=3D"#660066"><b>tools.staticdir.dir =
=3D &#39;./html&#39;,</b></font></div><div class=3D"subprettyprint" style=
=3D""><font color=3D"#660066"><b>tools.staticdir.index =3D &#39;index.html&=
#39;</b></font></div><div class=3D"subprettyprint" style=3D""><font color=
=3D"#660066"><b><br></b></font></div><div class=3D"subprettyprint" style=3D=
""><font color=3D"#660066"><b>[/css]</b></font></div><div class=3D"subprett=
yprint" style=3D""><font color=3D"#660066"><b>tools.staticdir.on =3D True</=
b></font></div><div class=3D"subprettyprint" style=3D""><font color=3D"#660=
066"><b>tools.staticdir.dir =3D &#39;./css&#39;</b></font></div><div style=
=3D"font-weight: bold;"><br></div></div></code></div><br></div><div style=
=3D"">If I remove everything from main.conf after [global], then the server=
 starts.</div><div style=3D"">But as soon as I add [/] and on then I get th=
e error.</div><div style=3D""><br></div><div style=3D"">Any ideas / help ?<=
/div><div style=3D""><br></div><div style=3D"">Thanks !!</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;cherrypy-users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:cherrypy-users+unsubscribe-/[email protected]">cher=
rypy-users+unsubscribe-/[email protected]</a>.<br />
To post to this group, send email to <a href=3D"mailto:cherrypy-users@googl=
egroups.com">cherrypy-users-/[email protected]</a>.<br />
Visit this group at <a href=3D"https://groups.google.com/group/cherrypy-use=
rs">https://groups.google.com/group/cherrypy-users</a>.<br />
For more options, visit <a href=3D"https://groups.google.com/d/optout">http=
s://groups.google.com/d/optout</a>.<br />

------=_Part_786_1385113630.1556114501205--

------=_Part_785_611265392.1556114501204--