web2py doesn't start!

137 views
Skip to first unread message

Nader Emami

unread,
May 3, 2013, 3:30:01 AM5/3/13
to web...@googlegroups.com

I would like to use the "web2py" framework. When I tried to run "python web2py", I got the next error:

Traceback (most recent call last):
  File "web2py.py", line 27, in <module>
    gluon.widget.start(cron=True)
  File "/home/nader/web2py/gluon/
widget.py", line 1054, in start
    (options, args) = console()
  File "/home/nader/web2py/gluon/
widget.py", line 921, in console
    if not is_loopback_ip_address(ip[4][
0])]))
  File "/home/nader/web2py/gluon/
utils.py", line 306, in is_loopback_ip_address
    if ip.count('.') == 3:  # IPv4
AttributeError: 'int' object has no attribute 'count'

Would somebody help me to solve this problem?

Best regards,
 
Nader

黄祥

unread,
May 3, 2013, 7:10:18 AM5/3/13
to web...@googlegroups.com
what kind of os did you use and what version of web2py did you use?

Nader Emami

unread,
May 3, 2013, 7:49:34 AM5/3/13
to web...@googlegroups.com
Thank for your email. I use Linux (gentoo) with Python-2.7.3. I have got yesterday the web2py_src.zip:
(Version 2.4.6-stable+timestamp.2013.04.06.17.37.38)

Nader


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/t_11PX-hYt0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Nader

黄祥

unread,
May 3, 2013, 8:00:39 AM5/3/13
to web...@googlegroups.com
i ran it on python 2.7.3 on lubuntu 12.10  and on centos 6.4 never get any problems. did you installed python from souce?

Anthony

unread,
May 3, 2013, 8:27:49 AM5/3/13
to web...@googlegroups.com
Did you run "python web2py" or "python web2py.py"?


On Friday, May 3, 2013 3:30:01 AM UTC-4, Nader Emami wrote:

Nader Emami

unread,
May 3, 2013, 9:53:10 AM5/3/13
to web...@googlegroups.com
I did the second one: "python web2py.py".

Nader Emami

unread,
May 3, 2013, 9:55:23 AM5/3/13
to web...@googlegroups.com
I didn't install python from source, Gentoo did it.

Anthony

unread,
May 3, 2013, 10:03:36 AM5/3/13
to web...@googlegroups.com
Hmm, not sure what's going on then.

Jonathan Lundell

unread,
May 3, 2013, 10:12:16 AM5/3/13
to web...@googlegroups.com
On 3 May 2013, at 4:49 AM, Nader Emami <n.e...@gmail.com> wrote:
> Thank for your email. I use Linux (gentoo) with Python-2.7.3. I have got yesterday the web2py_src.zip:
> (Version 2.4.6-stable+timestamp.2013.04.06.17.37.38)

Run Python from the command line and run (and report) what you get from:

import socket
socket.getaddrinfo(socket.getfqdn(), 0)

Massimo Di Pierro

unread,
May 3, 2013, 10:36:21 AM5/3/13
to web...@googlegroups.com
Can you please run a test for me?

python
>>> import socket
>>> print socket.getaddrinfo(socket.getfqdn(), 0)

what's the output?

Anyway you can run it with web2py.py --nogui
It is failing when making a guess for all your IP addresses. 

Jonathan Lundell

unread,
May 3, 2013, 10:50:52 AM5/3/13
to web...@googlegroups.com
On 3 May 2013, at 7:03 AM, Anthony <abas...@gmail.com> wrote:
Hmm, not sure what's going on then.

My guess is that socket.getaddrinfo is returning an address that's in a non-IP address family. We should probably be filtering on AF_INET and AF_INET6.

Jonathan Lundell

unread,
May 3, 2013, 11:48:39 AM5/3/13
to web...@googlegroups.com
On 3 May 2013, at 7:50 AM, Jonathan Lundell <jlun...@pobox.com> wrote:
> On 3 May 2013, at 7:03 AM, Anthony <abas...@gmail.com> wrote:
>> Hmm, not sure what's going on then.
>
> My guess is that socket.getaddrinfo is returning an address that's in a non-IP address family. We should probably be filtering on AF_INET and AF_INET6.

Proposed fix: pass the entire ip tuple (from getaddrinfo) to is_loopback_ip_address, and maybe (for backward compatibility in case any app is using it?) test the type of the argument. Or something.

So, change:

options.ips = list(set([
ip[4][0] for ip in socket.getaddrinfo(socket.getfqdn(), 0)
if not is_loopback_ip_address(ip[4][0])]))

to

options.ips = list(set([
addrinfo[4][0] for addrinfo in socket.getaddrinfo(socket.getfqdn(), None)
if not is_loopback_ip_address(addrinfo=addrinfo)]))
and change:

def is_loopback_ip_address(ip):
"""Determines whether the IP address appears to be a loopback address.

This assumes that the IP is valid. The IPv6 check is limited to '::1'.

"""
if not ip:
return False
if ip.count('.') == 3: # IPv4
return ip.startswith('127') or ip.startswith('::ffff:127')
return ip == '::1' # IPv6

to:

def is_loopback_ip_address(ip=None, addrinfo=None):
"""Determines whether the address appears to be an IP loopback address.

This assumes that the IP is valid. The IPv6 check is limited to '::1'.
addrinfo is a tuple from socket.getaddrinfo()

"""
if addrinfo and addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6:
ip = addrinfo[4]
if not ip:
return False
if ip.count('.') == 3: # IPv4
return ip.startswith('127') or ip.startswith('::ffff:127')
return ip == '::1' # IPv6

Nader Emami

unread,
May 3, 2013, 1:02:21 PM5/3/13
to web...@googlegroups.com
The output of "print socket.getaddrinfo(socket.getfqdn(), 0)" is:


[(10, 1, 6, '', (10, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')), (10, 2, 17, '', (10, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')), (10, 3, 0, '', (10, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')), (2, 1, 6, '', ('127.0.0.1', 0)), (2, 2, 17, '', ('127.0.0.1', 0)), (2, 3, 0, '', ('127.0.0.1', 0))]


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/t_11PX-hYt0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Nader

Jonathan Lundell

unread,
May 3, 2013, 1:47:48 PM5/3/13
to web...@googlegroups.com
Odd. Looks like misconfigured IPv6. Need to add a check to my patch to check for a string. 
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

黄祥

unread,
May 3, 2013, 2:53:48 PM5/3/13
to web...@googlegroups.com
had you already try disable the ipv6 in your network configuration?

Nader Emami

unread,
May 3, 2013, 4:24:50 PM5/3/13
to web...@googlegroups.com
No! Because I don't know how I can do it.

Cheers!

黄祥

unread,
May 3, 2013, 7:30:39 PM5/3/13
to web...@googlegroups.com
I think you need to edit /etc/modprobe.d/modprobe.conf and /etc/modprobe.d/aliases.conf. In the files I found out this: 
Code:

# Uncomment the network protocols you don't want loaded: 
# alias net-pf-2 off            # IPv4 
alias net-pf-10 off           # IPv6 

after that please restart your network service and run python web2py.py again
not tested, because i'm don't have gentoo machine, hope this can help

ref:

Jonathan Lundell

unread,
May 3, 2013, 8:03:05 PM5/3/13
to web...@googlegroups.com
On 3 May 2013, at 10:47 AM, Jonathan Lundell <jlun...@pobox.com> wrote:
Odd. Looks like misconfigured IPv6. Need to add a check to my patch to check for a string. 


Massimo, I filed Issue #1474 against this bug, and attached an untested patch.

Nader Emami

unread,
May 4, 2013, 5:09:45 AM5/4/13
to web...@googlegroups.com
Thank you for your advice. I would explain what I have done to set-off the IPV6 option.

Firstly I have uncomment the statement "alias net-pf-10 off             # IPv6" in  the file "/etc/modprobe.d/aliases.conf" and then run "python web2py.py". Unfortunately without any result, I got the same error.

Then I have recompile the kernel and set-off the "IPV6" kernel.

less /usr/src/linux/.config | grep -i ipv6
# CONFIG_IPV6 is not set

Once again I tried to start "web2py.py" in recompiled kernel (without IPV6 option + alias net-pf-10 off             # IPv6et in config file). It didn't and I have gotten the same error.  I would probably say that the problem is not the "IPV6". Naturally I am not sure!

With regards,
Nader


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/t_11PX-hYt0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Nader

Nader Emami

unread,
May 4, 2013, 7:09:45 AM5/4/13
to web...@googlegroups.com

Jonathan Lundell

unread,
May 4, 2013, 10:10:26 AM5/4/13
to web...@googlegroups.com
On 4 May 2013, at 2:09 AM, Nader Emami <n.e...@gmail.com> wrote:
Thank you for your advice. I would explain what I have done to set-off the IPV6 option. 

Firstly I have uncomment the statement "alias net-pf-10 off             # IPv6" in  the file "/etc/modprobe.d/aliases.conf" and then run "python web2py.py". Unfortunately without any result, I got the same error.

Then I have recompile the kernel and set-off the "IPV6" kernel. 

less /usr/src/linux/.config | grep -i ipv6
# CONFIG_IPV6 is not set

Once again I tried to start "web2py.py" in recompiled kernel (without IPV6 option + alias net-pf-10 off             # IPv6et in config file). It didn't and I have gotten the same error.  I would probably say that the problem is not the "IPV6". Naturally I am not sure! 

If you can, please try the current trunk; it has a patch that should fix the problem.

Nader Emami

unread,
May 4, 2013, 10:43:26 AM5/4/13
to web...@googlegroups.com
which "trunk"? I don't see any one!


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/t_11PX-hYt0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Nader

黄祥

unread,
May 4, 2013, 10:47:36 AM5/4/13
to web...@googlegroups.com
please go to 
and then click source code in for testers coloumn
Reply all
Reply to author
Forward
0 new messages