Re: [web2py] Re: Scheduler is Not Running

2019-05-24 Thread Suhas Jadhav
HI Dave,

How do I make hcstar  as a task. What is wrong in my code?

Thanks,
Suhas

On Fri, May 24, 2019 at 1:25 PM Dave S  wrote:

>
>
> On Friday, May 24, 2019 at 12:05:31 AM UTC-7, Suhas Jadhav wrote:
>>
>> Hi,
>>
>> I have following code
>>
>> def fun1:
>> do something
>> returns locals()
>>
>> I have below code in scheduler.py
>>
>> def hcstar():
>> LOAD('monitoring',' fun1')
>>
>> from gluon.scheduler import Scheduler
>> scheduler2 = Scheduler(db,tasks=dict(hcstar=hcstar,fun1=func2))
>>
>
> From your defuns, neither hcstar nor fun1 appear to be task-like.  Tasks
> do not talk directly to a client ("the user"); instead they perform work on
> files or database entries or some such.  The scheduler will record their
> "stdout" (print statements, etc) and if the task returns a string or
> boolean.  If you're just trying to get familiar with setting up tasks, a
> function that does a print("Hello from taskA") and returns a True will work
> nicely.
>
> The other part of the equation is that you have to have a thread or job
> running somewhere to launch the workers.  That's the job of the -K command
> line parameter.
>
>
>
>> I have scheduled the task to run every 5 min.
>> I can see the task is changing the status as ASSIGNED-->QUEUED
>> But I do not see the record being inserted into  db.scheduler_run
>> <http://10.184.96.105/bot/appadmin/select/db?query=db.scheduler_run.id%3E0>
>>
>>  Also function  fun1  is not being called.
>>
>> Can anybody help.
>>
>>
>>
>> --
>> Thanks,
>> Suhas
>>
>
>
> Good luck!
>
> Dave
> /dps
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/33d86058-a557-49c6-9f7a-60cda9cdc030%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/33d86058-a557-49c6-9f7a-60cda9cdc030%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Thanks,
Suhas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAM9jc1Bqs5-TEwjtQUNPMenGvkHZLoDA_NZ3NrNktJsStX1BRQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Scheduler is Not Running

2019-05-24 Thread Suhas Jadhav
Hi,

I have following code

def fun1:
do something
returns locals()

I have below code in scheduler.py

def hcstar():
LOAD('monitoring',' fun1')

from gluon.scheduler import Scheduler
scheduler2 = Scheduler(db,tasks=dict(hcstar=hcstar,fun1=func2))

I have scheduled the task to run every 5 min.
I can see the task is changing the status as ASSIGNED-->QUEUED
But I do not see the record being inserted into  db.scheduler_run

 Also function  fun1  is not being called.

Can anybody help.



-- 
Thanks,
Suhas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAM9jc1CDS1XN6YvfYFoaQ__j-bV4HtCRbr%3DK0OJzz4V7mwx4wQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Password File

2019-05-13 Thread Suhas Jadhav
Hi Gurus,
In my web2py application, i am connecting to two different databases.
Currently, I am saving username and password in the code.
I want to use a password file or some other mean. Can you please help.

-- 
Thanks,
Suhas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAM9jc1B6LSyDViqxfnwpS6VZYSB%2Bi4SrovmfKAR5%3DqghnZ8pKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: LDAP Authentication never work

2018-07-03 Thread Suhas Jadhav
Hi
Where can I get the logs?
Is there any location where I can check?

Thanks,
suhas

On Fri, Jun 29, 2018 at 3:05 PM 黄祥  wrote:

> i've test it without change auth = Auth(db) in db.py
> the logs is depend on your ldap server configuration (389-ds, openldap,
> etc), that's why i in another thread, i start the ldap server directly (no
> daemonize), so that every single hit (whatever try to reach the ldap
> server, success or not will print on the terminal)
> not sure what going on with your side, because no logs or error provided
> (web2py or ldap server).
> my suggestion is pls start from simple first, in your dev env :
> - create your ldap server (apacheds not hurt, just download and run it, no
> installation like 389-ds or openldap)
> - run apacheds from terminal, create a ou (whatever you want in ldap
> server, preferable using apache directory server or you can use slapd)
> - create new web2py app
> - copas about ldap auth from web2py book (link provide on prev message)
>
> then if still can not, pls come back with the error log shown in ldap
> server (apacheds terminal)
>
> good luck n best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: LDAP Authentication never work

2018-06-29 Thread Suhas Jadhav
In db.py i have auth = Auth(db)
Do i need to change this for ldap_auth to work?

Thanks,
Suhas

On Fri, Jun 29, 2018 at 1:35 PM Suhas Jadhav  wrote:

> It is still not working for me,
> Is there a way to see the logs? I want to see if ldap_auth is not able to
> contact my ldap server or any other reason
>
>
> Thanks,
> Suhas
>
> On Fri, Jun 15, 2018 at 6:46 PM 黄祥  wrote:
>
>> it should work (ignore configuration on previous message), pls follow
>> this thread discussion for detail or read the book:
>> ref:
>> https://groups.google.com/forum/#!topic/web2py/tWa5BPDMglk
>>
>> http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms
>>
>> best regards,
>> stifan
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: LDAP Authentication never work

2018-06-29 Thread Suhas Jadhav
It is still not working for me,
Is there a way to see the logs? I want to see if ldap_auth is not able to
contact my ldap server or any other reason


Thanks,
Suhas

On Fri, Jun 15, 2018 at 6:46 PM 黄祥  wrote:

> it should work (ignore configuration on previous message), pls follow this
> thread discussion for detail or read the book:
> ref:
> https://groups.google.com/forum/#!topic/web2py/tWa5BPDMglk
>
> http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms
>
> best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: LDAP Authentication never work

2018-06-14 Thread Suhas Jadhav
Hi  stifan,

Thaks for checking my issue.
I uninstalled python 3 and install Python 2.7.15
Not the application is allowing me to log in. But even if I give incorrect
username and password it shows successful login.

What might be wrong?

Thanks,
Suhas

On Wed, Jun 13, 2018 at 2:06 AM 黄祥  wrote:

> not sure why not work in your place, pls check the log (ldap server or
> web2py), i've tried from scratch work fine
> *env i used:*
> - web2py 2.16.1-stable
> - Python 2.7.15
> - installed module python-ldap with pip install python-ldap
> - apacheds from scratch (https://directory.apache.org/apacheds)
>
> *step i took:*
> - create new web2py app: ldap
> - modified:
> *models/db.py*
> auth.define_tables(username=True, signature=False)
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(mode = 'ad',
>  server = 'localhost',
>  port = 10389,
>  base_dn =
> 'ou=system,dc=example,dc=com') )
> """
> # test with mode=cn work fine too
> auth.settings.login_methods.append(ldap_auth(mode = 'cn',
>  server = 'localhost',
>  port = 10389,
>  base_dn =
> 'ou=system,dc=example,dc=com') )
> """
> auth.settings.login_methods = [ldap_auth]
>
> *controllers/default.py*
> @auth.requires_login()
> def test():
> return locals()
>
> - open http://localhost:8000/ldap/default/test
> enter (apacheds ldap default login)
> username : admin
> password : secret
>
> best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: LDAP Authentication never work

2018-06-12 Thread Suhas Jadhav
Hi Stifan,

Any solution for me?

Thanks,
Suhas

On Sun, Jun 10, 2018 at 10:47 PM Suhas Jadhav 
wrote:

> Hi stifan,
>
> Thanks for reply. But it is still validating against the DB  and not LDAP
>
> Thanks,
> Suhas
>
> On Friday, 8 June 2018 16:39:15 UTC-7, 黄祥 wrote:
>>
>> pls try (not tested)
>> *models/db.py*
>> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>> auth.settings.login_methods.append(ldap_auth(
>> mode='ad', 
>> server='ldaps://chexadcexp001.expeso.com:636',base_dn='ou=Service
>> Accounts,dc=sea,dc=corp,dc=com') )
>> auth.settings.login_methods = [ldap_auth]
>>
>> *controllers/default.py*
>> @auth.requires_login()
>> def test():
>> return locals()
>>
>> best regards,
>> stifan
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: LDAP Authentication never work

2018-06-10 Thread Suhas Jadhav
Hi stifan,

Thanks for reply. But it is still validating against the DB  and not LDAP

Thanks,
Suhas

On Friday, 8 June 2018 16:39:15 UTC-7, 黄祥 wrote:
>
> pls try (not tested)
> *models/db.py*
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(
> mode='ad', 
> server='ldaps://chexadcexp001.expeso.com:636',base_dn='ou=Service 
> Accounts,dc=sea,dc=corp,dc=com') )
> auth.settings.login_methods = [ldap_auth]
>
> *controllers/default.py*
> @auth.requires_login()
> def test():
> return locals()
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: LDAP Authentication never work

2018-06-08 Thread Suhas Jadhav
Are you saying i should do as below? It did not work for me.


from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
auth.settings.remember_me_form = False
auth.settings.login_methods=[ldap_auth(
mode='ad',
server='ldaps://chexadcexp001.expeso.com:636',base_dn='ou=Service
Accounts,dc=sea,dc=corp,dc=com') ]
@auth.requires_login()
def test():
return locals()

On Fri, Jun 8, 2018 at 2:59 AM Leonel Câmara  wrote:

> Note that your function is decorated with
>
> @auth.requires_login()
>
> However you only change the authentication method to LDAP inside that same
> function, so before the function runs it will only have the regular login
> and will require it. You need to do that stuff before the controller
> function runs in a model file.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] LDAP Authentication never work

2018-06-08 Thread Suhas Jadhav
Hi Gurus,

My below code always authenticate against db and not ldap. Can you please 
help.

@auth.requires_login()
def test():
from gluon.contrib.login_methods.ldap_auth import ldap_auth

auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
auth.settings.remember_me_form = False
auth.settings.login_methods=[ldap_auth(
mode='ad', server='ldaps://server.com',base_dn='ou=Service 
Accounts,dc=sea,dc=corp,dc=com') ]


return locals()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Getting Error ModuleNotFoundError: No module named 'urllib2'

2018-06-07 Thread Suhas Jadhav
Even if I use below code in the controller. Just the import
I am getting error 

Traceback (most recent call last):
  File "C:\WEB2PY\web2py\gluon\custom_import.py", line 77, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)

ModuleNotFoundError: No module named 'urllib2' 

*
def test():
from gluon.contrib.login_methods.basic_auth import basic_auth
   
return locals()

*

On Monday, 4 June 2018 06:44:37 UTC-7, Suhas Jadhav wrote:
>
> Hi,
> I am getting error ModuleNotFoundError: No module named 'urllib2'
>
> My Code is 
>
> def test():
> import ldap
> from urllib.request import urlopen
> import urllib2
> import urllib
>
>  
> auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
> auth.settings.remember_me_form = False
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods = [ldap_auth(mode='ad',
> server='sever.com',
> base_dn='dc="DC,dc=corp,dc="DC",dc=com')]
> 
> from gluon.contrib.login_methods.basic_auth import basic_auth
> auth.settings.login_methods.append(
> basic_auth('https://example.com'))
> return locals()
>
>
> ERROR
>
> Traceback (most recent call last):
>   File "C:\WEB2PY\web2py\gluon\custom_import.py", line 77, in custom_importer
> return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
> ModuleNotFoundError: No module named 'urllib2'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "C:\WEB2PY\web2py\gluon\custom_import.py", line 90, in custom_importer
> result = result or sys.modules[modules_prefix+'.'+itemname]
> KeyError: 'applications.welcome.modules.urllib2'
>
>
> All the imports work from python terminal but not from web2py
> import ldap
> from urllib.request import urlopen
> import urllib2
> import urllib
>
>
> VERSION
> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
>
> PYTHON Python 3.6.2
>
>
> Any solution or workaround?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Getting Error ModuleNotFoundError: No module named 'urllib2'

2018-06-04 Thread Suhas Jadhav
Yes, I say the documentation. But issues here is urllib2 works well from my 
python console.
the error happens when web2py tries to call it.
My code is not calling it directly. I believe ldap_auth library calling urllib2 
internally and faile.

Thanks,
Suhas

On Monday, 4 June 2018 06:44:37 UTC-7, Suhas Jadhav wrote:
>
> Hi,
> I am getting error ModuleNotFoundError: No module named 'urllib2'
>
> My Code is 
>
> def test():
> import ldap
> from urllib.request import urlopen
> import urllib2
> import urllib
>
>  
> auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
> auth.settings.remember_me_form = False
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods = [ldap_auth(mode='ad',
> server='sever.com',
> base_dn='dc="DC,dc=corp,dc="DC",dc=com')]
> 
> from gluon.contrib.login_methods.basic_auth import basic_auth
> auth.settings.login_methods.append(
> basic_auth('https://example.com'))
> return locals()
>
>
> ERROR
>
> Traceback (most recent call last):
>   File "C:\WEB2PY\web2py\gluon\custom_import.py", line 77, in custom_importer
> return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
> ModuleNotFoundError: No module named 'urllib2'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "C:\WEB2PY\web2py\gluon\custom_import.py", line 90, in custom_importer
> result = result or sys.modules[modules_prefix+'.'+itemname]
> KeyError: 'applications.welcome.modules.urllib2'
>
>
> All the imports work from python terminal but not from web2py
> import ldap
> from urllib.request import urlopen
> import urllib2
> import urllib
>
>
> VERSION
> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
>
> PYTHON Python 3.6.2
>
>
> Any solution or workaround?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Getting Error ModuleNotFoundError: No module named 'urllib2'

2018-06-04 Thread Suhas Jadhav
Hi,
I am getting error ModuleNotFoundError: No module named 'urllib2'

My Code is 

def test():
import ldap
from urllib.request import urlopen
import urllib2
import urllib
   
 
auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
auth.settings.remember_me_form = False
from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',
server='sever.com',
base_dn='dc="DC,dc=corp,dc="DC",dc=com')]

from gluon.contrib.login_methods.basic_auth import basic_auth
auth.settings.login_methods.append(
basic_auth('https://example.com'))
return locals()


ERROR

Traceback (most recent call last):
  File "C:\WEB2PY\web2py\gluon\custom_import.py", line 77, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'urllib2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\WEB2PY\web2py\gluon\custom_import.py", line 90, in custom_importer
result = result or sys.modules[modules_prefix+'.'+itemname]
KeyError: 'applications.welcome.modules.urllib2'


All the imports work from python terminal but not from web2py
import ldap
from urllib.request import urlopen
import urllib2
import urllib


VERSION
web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25

PYTHON Python 3.6.2


Any solution or workaround?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.