Re: [web2py] Re: Cannot import module 'ldap'
Nicholas, I'm sorry but this is not what Massimo asked for. You need to run these commands from inside web2py, after you've run it with: python web2py.py -S welcome and not from a pure python shell. Also, how do you normally run web2py? Launching web2py.exe ? Cheers, Nico 2013/2/6 Nicholas Duffy duffy.nicho...@gmail.com C:\Console2python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type help, copyright, credits or license for more information. import ldap import ldap.filter import sys print sys.path ['', 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg', 'C:\\Pytho n27\\lib\\site-packages\\pip-1.2.1-py2.7.egg', 'C:\\Windows\\system32\\python27. zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Users\\nick.duffy\\Dropbox\\Work\\Apollo\\MINDBODYAPI\\mbapi', 'C:\\Python 27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin'] On Tuesday, February 5, 2013 3:28:03 PM UTC-7, Massimo Di Pierro wrote: No idea. Whan you try open the web2py shell and try a manual import python web2py.py -S welcome import ldap import ldap.filter import sys print sys.path On Tuesday, 5 February 2013 16:20:05 UTC-6, Nicholas Duffy wrote: Thanks for the reply Massimo. Do you mean the web2py source? Because that is what I am using. I am able to import other packages that I've installed via binary in lib\site-packages like pyodbc and suds. I cannot seem to import ldap, though. On Tuesday, February 5, 2013 7:36:58 AM UTC-7, Massimo Di Pierro wrote: Since you are using the windows binary, it comes with its own python and it does not see packages you installed on you other python. Your best option is use the web2py source distribution. It will see packages you install. On Monday, 4 February 2013 17:09:13 UTC-6, Nicholas Duffy wrote: Hello all, -I have downloaded and installed python-ldap 2.4.10 from here: http://pypi.python.org/pypi/**python-ldap/2.4.10http://pypi.python.org/pypi/python-ldap/2.4.10 --Windows binary 2.4.10 for Python 2.7 --I get no errors when trying to import in the shell, so it's installed. -I have followed the directions here to attempt to setup authentication with MS Active Directory: http://web2py.com/books/** default/chapter/29/09 http://web2py.com/books/default/chapter/29/09 However, immediately upon running my application, I receive this error: ImportError: Cannot import module 'ldap' File C:\Python27\Lib\threading.py**, line 524, in __bootstrap self.__bootstrap_inner() File C:\Python27\Lib\threading.py**, line 551, in __bootstrap_inner self.run() File c:\web2py\gluon\rocket.py, line 1337, in run self.run_app(conn) File c:\web2py\gluon\rocket.py, line 1838, in run_app output = self.app(environ, self.start_response) File c:\web2py\gluon\main.py, line 725, in app_with_logging ret[0] = wsgiapp(environ, responder2) File c:\web2py\gluon\main.py, line 543, in wsgibase serve_controller(request, response, session) File c:\web2py\gluon\main.py, line 221, in serve_controller run_models_in(environment) File c:\web2py\gluon\compileapp.**py, line 539, in run_models_in restricted(code, environment, layer=model) File c:\web2py\gluon\restricted.**py, line 223, in restricted sys.excepthook(etype, evalue, tb) File c:\web2py\applications\**apollo\models\db.py, line 44, in module from gluon.contrib.login_methods.**ldap_auth import ldap_auth File c:\web2py\gluon\custom_**import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File c:\web2py\gluon\contrib\**login_methods\ldap_auth.py, line 14, in module raise e What simple step am I missing? Thanks. -- --- 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/groups/opt_out. -- --- 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/groups/opt_out.
Re: [web2py] Re: Cannot import module 'ldap'
Mistakenly ran in the shell but updated my post shortly after. No not via the exe but via web2py.py. I've tried both locally debugging via Wing and on my server running but receive the same error. I'm sure I'm doing something simple wrong. -- --- 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/groups/opt_out.
Re: [web2py] Re: Cannot import module 'ldap'
Upon further research it appears that I'm unable to import ldap in only one of my applications. It works in others, but just not this one. I copied the db.py from one of the working applications over but still no luck. I'll keep digging but any suggestions as to where to look would greatly be appreciated. c:\web2pypython web2py.py -S training web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.3.2 (2012-12-17 15:03:30) stable Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. (InteractiveConsole) import ldap ^Z c:\web2pypython web2py.py -S apollo web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.3.2 (2012-12-17 15:03:30) stable Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. (InteractiveConsole) import ldap Traceback (most recent call last): File console, line 1, in module File c:\web2py\gluon\custom_import.py, line 77, in custom_importer raise ImportError, 'Cannot import module %s' % str(e) ImportError: Cannot import module 'ldap' On Wednesday, February 6, 2013 3:17:31 AM UTC-7, Nicholas Duffy wrote: Mistakenly ran in the shell but updated my post shortly after. No not via the exe but via web2py.py. I've tried both locally debugging via Wing and on my server running but receive the same error. I'm sure I'm doing something simple wrong. -- --- 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/groups/opt_out.
Re: [web2py] Re: Cannot import module 'ldap'
Got it! Apparently the file I had in the modules folder was causing the problem. I don't understand why, but time to go read the docs. Thanks for everybody posting. On Wednesday, February 6, 2013 1:13:45 PM UTC-7, Nicholas Duffy wrote: Upon further research it appears that I'm unable to import ldap in only one of my applications. It works in others, but just not this one. I copied the db.py from one of the working applications over but still no luck. I'll keep digging but any suggestions as to where to look would greatly be appreciated. c:\web2pypython web2py.py -S training web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.3.2 (2012-12-17 15:03:30) stable Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. (InteractiveConsole) import ldap ^Z c:\web2pypython web2py.py -S apollo web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.3.2 (2012-12-17 15:03:30) stable Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. (InteractiveConsole) import ldap Traceback (most recent call last): File console, line 1, in module File c:\web2py\gluon\custom_import.py, line 77, in custom_importer raise ImportError, 'Cannot import module %s' % str(e) ImportError: Cannot import module 'ldap' On Wednesday, February 6, 2013 3:17:31 AM UTC-7, Nicholas Duffy wrote: Mistakenly ran in the shell but updated my post shortly after. No not via the exe but via web2py.py. I've tried both locally debugging via Wing and on my server running but receive the same error. I'm sure I'm doing something simple wrong. -- --- 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/groups/opt_out.
[web2py] Re: Cannot import module 'ldap'
Since you are using the windows binary, it comes with its own python and it does not see packages you installed on you other python. Your best option is use the web2py source distribution. It will see packages you install. On Monday, 4 February 2013 17:09:13 UTC-6, Nicholas Duffy wrote: Hello all, -I have downloaded and installed python-ldap 2.4.10 from here: http://pypi.python.org/pypi/python-ldap/2.4.10 --Windows binary 2.4.10 for Python 2.7 --I get no errors when trying to import in the shell, so it's installed. -I have followed the directions here to attempt to setup authentication with MS Active Directory: http://web2py.com/books/default/chapter/29/09 However, immediately upon running my application, I receive this error: ImportError: Cannot import module 'ldap' File C:\Python27\Lib\threading.py, line 524, in __bootstrap self.__bootstrap_inner() File C:\Python27\Lib\threading.py, line 551, in __bootstrap_inner self.run() File c:\web2py\gluon\rocket.py, line 1337, in run self.run_app(conn) File c:\web2py\gluon\rocket.py, line 1838, in run_app output = self.app(environ, self.start_response) File c:\web2py\gluon\main.py, line 725, in app_with_logging ret[0] = wsgiapp(environ, responder2) File c:\web2py\gluon\main.py, line 543, in wsgibase serve_controller(request, response, session) File c:\web2py\gluon\main.py, line 221, in serve_controller run_models_in(environment) File c:\web2py\gluon\compileapp.py, line 539, in run_models_in restricted(code, environment, layer=model) File c:\web2py\gluon\restricted.py, line 223, in restricted sys.excepthook(etype, evalue, tb) File c:\web2py\applications\apollo\models\db.py, line 44, in module from gluon.contrib.login_methods.ldap_auth import ldap_auth File c:\web2py\gluon\custom_import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File c:\web2py\gluon\contrib\login_methods\ldap_auth.py, line 14, in module raise e What simple step am I missing? Thanks. -- --- 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/groups/opt_out.
[web2py] Re: Cannot import module 'ldap'
Thanks for the reply Massimo. Do you mean the web2py source? Because that is what I am using. I am able to import other packages that I've installed via binary in lib\site-packages like pyodbc and suds. I cannot seem to import ldap, though. On Tuesday, February 5, 2013 7:36:58 AM UTC-7, Massimo Di Pierro wrote: Since you are using the windows binary, it comes with its own python and it does not see packages you installed on you other python. Your best option is use the web2py source distribution. It will see packages you install. On Monday, 4 February 2013 17:09:13 UTC-6, Nicholas Duffy wrote: Hello all, -I have downloaded and installed python-ldap 2.4.10 from here: http://pypi.python.org/pypi/python-ldap/2.4.10 --Windows binary 2.4.10 for Python 2.7 --I get no errors when trying to import in the shell, so it's installed. -I have followed the directions here to attempt to setup authentication with MS Active Directory: http://web2py.com/books/default/chapter/29/09 However, immediately upon running my application, I receive this error: ImportError: Cannot import module 'ldap' File C:\Python27\Lib\threading.py, line 524, in __bootstrap self.__bootstrap_inner() File C:\Python27\Lib\threading.py, line 551, in __bootstrap_inner self.run() File c:\web2py\gluon\rocket.py, line 1337, in run self.run_app(conn) File c:\web2py\gluon\rocket.py, line 1838, in run_app output = self.app(environ, self.start_response) File c:\web2py\gluon\main.py, line 725, in app_with_logging ret[0] = wsgiapp(environ, responder2) File c:\web2py\gluon\main.py, line 543, in wsgibase serve_controller(request, response, session) File c:\web2py\gluon\main.py, line 221, in serve_controller run_models_in(environment) File c:\web2py\gluon\compileapp.py, line 539, in run_models_in restricted(code, environment, layer=model) File c:\web2py\gluon\restricted.py, line 223, in restricted sys.excepthook(etype, evalue, tb) File c:\web2py\applications\apollo\models\db.py, line 44, in module from gluon.contrib.login_methods.ldap_auth import ldap_auth File c:\web2py\gluon\custom_import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File c:\web2py\gluon\contrib\login_methods\ldap_auth.py, line 14, in module raise e What simple step am I missing? Thanks. -- --- 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/groups/opt_out.
[web2py] Re: Cannot import module 'ldap'
No idea. Whan you try open the web2py shell and try a manual import python web2py.py -S welcome import ldap import ldap.filter import sys print sys.path On Tuesday, 5 February 2013 16:20:05 UTC-6, Nicholas Duffy wrote: Thanks for the reply Massimo. Do you mean the web2py source? Because that is what I am using. I am able to import other packages that I've installed via binary in lib\site-packages like pyodbc and suds. I cannot seem to import ldap, though. On Tuesday, February 5, 2013 7:36:58 AM UTC-7, Massimo Di Pierro wrote: Since you are using the windows binary, it comes with its own python and it does not see packages you installed on you other python. Your best option is use the web2py source distribution. It will see packages you install. On Monday, 4 February 2013 17:09:13 UTC-6, Nicholas Duffy wrote: Hello all, -I have downloaded and installed python-ldap 2.4.10 from here: http://pypi.python.org/pypi/python-ldap/2.4.10 --Windows binary 2.4.10 for Python 2.7 --I get no errors when trying to import in the shell, so it's installed. -I have followed the directions here to attempt to setup authentication with MS Active Directory: http://web2py.com/books/default/chapter/29/09 However, immediately upon running my application, I receive this error: ImportError: Cannot import module 'ldap' File C:\Python27\Lib\threading.py, line 524, in __bootstrap self.__bootstrap_inner() File C:\Python27\Lib\threading.py, line 551, in __bootstrap_inner self.run() File c:\web2py\gluon\rocket.py, line 1337, in run self.run_app(conn) File c:\web2py\gluon\rocket.py, line 1838, in run_app output = self.app(environ, self.start_response) File c:\web2py\gluon\main.py, line 725, in app_with_logging ret[0] = wsgiapp(environ, responder2) File c:\web2py\gluon\main.py, line 543, in wsgibase serve_controller(request, response, session) File c:\web2py\gluon\main.py, line 221, in serve_controller run_models_in(environment) File c:\web2py\gluon\compileapp.py, line 539, in run_models_in restricted(code, environment, layer=model) File c:\web2py\gluon\restricted.py, line 223, in restricted sys.excepthook(etype, evalue, tb) File c:\web2py\applications\apollo\models\db.py, line 44, in module from gluon.contrib.login_methods.ldap_auth import ldap_auth File c:\web2py\gluon\custom_import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File c:\web2py\gluon\contrib\login_methods\ldap_auth.py, line 14, in module raise e What simple step am I missing? Thanks. -- --- 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/groups/opt_out.
[web2py] Re: Cannot import module 'ldap'
Have you installed python-ldap - http://pypi.python.org/pypi/python-ldap/ ? On Tuesday, February 5, 2013 4:20:05 PM UTC-6, Nicholas Duffy wrote: Thanks for the reply Massimo. Do you mean the web2py source? Because that is what I am using. I am able to import other packages that I've installed via binary in lib\site-packages like pyodbc and suds. I cannot seem to import ldap, though. On Tuesday, February 5, 2013 7:36:58 AM UTC-7, Massimo Di Pierro wrote: Since you are using the windows binary, it comes with its own python and it does not see packages you installed on you other python. Your best option is use the web2py source distribution. It will see packages you install. On Monday, 4 February 2013 17:09:13 UTC-6, Nicholas Duffy wrote: Hello all, -I have downloaded and installed python-ldap 2.4.10 from here: http://pypi.python.org/pypi/python-ldap/2.4.10 --Windows binary 2.4.10 for Python 2.7 --I get no errors when trying to import in the shell, so it's installed. -I have followed the directions here to attempt to setup authentication with MS Active Directory: http://web2py.com/books/default/chapter/29/09 However, immediately upon running my application, I receive this error: ImportError: Cannot import module 'ldap' File C:\Python27\Lib\threading.py, line 524, in __bootstrap self.__bootstrap_inner() File C:\Python27\Lib\threading.py, line 551, in __bootstrap_inner self.run() File c:\web2py\gluon\rocket.py, line 1337, in run self.run_app(conn) File c:\web2py\gluon\rocket.py, line 1838, in run_app output = self.app(environ, self.start_response) File c:\web2py\gluon\main.py, line 725, in app_with_logging ret[0] = wsgiapp(environ, responder2) File c:\web2py\gluon\main.py, line 543, in wsgibase serve_controller(request, response, session) File c:\web2py\gluon\main.py, line 221, in serve_controller run_models_in(environment) File c:\web2py\gluon\compileapp.py, line 539, in run_models_in restricted(code, environment, layer=model) File c:\web2py\gluon\restricted.py, line 223, in restricted sys.excepthook(etype, evalue, tb) File c:\web2py\applications\apollo\models\db.py, line 44, in module from gluon.contrib.login_methods.ldap_auth import ldap_auth File c:\web2py\gluon\custom_import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File c:\web2py\gluon\contrib\login_methods\ldap_auth.py, line 14, in module raise e What simple step am I missing? Thanks. -- --- 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/groups/opt_out.
[web2py] Re: Cannot import module 'ldap'
C:\Console2python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type help, copyright, credits or license for more information. import ldap import ldap.filter import sys print sys.path ['', 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg', 'C:\\Pytho n27\\lib\\site-packages\\pip-1.2.1-py2.7.egg', 'C:\\Windows\\system32\\python27. zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Users\\nick.duffy\\Dropbox\\Work\\Apollo\\MINDBODYAPI\\mbapi', 'C:\\Python 27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin'] On Tuesday, February 5, 2013 3:28:03 PM UTC-7, Massimo Di Pierro wrote: No idea. Whan you try open the web2py shell and try a manual import python web2py.py -S welcome import ldap import ldap.filter import sys print sys.path On Tuesday, 5 February 2013 16:20:05 UTC-6, Nicholas Duffy wrote: Thanks for the reply Massimo. Do you mean the web2py source? Because that is what I am using. I am able to import other packages that I've installed via binary in lib\site-packages like pyodbc and suds. I cannot seem to import ldap, though. On Tuesday, February 5, 2013 7:36:58 AM UTC-7, Massimo Di Pierro wrote: Since you are using the windows binary, it comes with its own python and it does not see packages you installed on you other python. Your best option is use the web2py source distribution. It will see packages you install. On Monday, 4 February 2013 17:09:13 UTC-6, Nicholas Duffy wrote: Hello all, -I have downloaded and installed python-ldap 2.4.10 from here: http://pypi.python.org/pypi/python-ldap/2.4.10 --Windows binary 2.4.10 for Python 2.7 --I get no errors when trying to import in the shell, so it's installed. -I have followed the directions here to attempt to setup authentication with MS Active Directory: http://web2py.com/books/default/chapter/29/09 However, immediately upon running my application, I receive this error: ImportError: Cannot import module 'ldap' File C:\Python27\Lib\threading.py, line 524, in __bootstrap self.__bootstrap_inner() File C:\Python27\Lib\threading.py, line 551, in __bootstrap_inner self.run() File c:\web2py\gluon\rocket.py, line 1337, in run self.run_app(conn) File c:\web2py\gluon\rocket.py, line 1838, in run_app output = self.app(environ, self.start_response) File c:\web2py\gluon\main.py, line 725, in app_with_logging ret[0] = wsgiapp(environ, responder2) File c:\web2py\gluon\main.py, line 543, in wsgibase serve_controller(request, response, session) File c:\web2py\gluon\main.py, line 221, in serve_controller run_models_in(environment) File c:\web2py\gluon\compileapp.py, line 539, in run_models_in restricted(code, environment, layer=model) File c:\web2py\gluon\restricted.py, line 223, in restricted sys.excepthook(etype, evalue, tb) File c:\web2py\applications\apollo\models\db.py, line 44, in module from gluon.contrib.login_methods.ldap_auth import ldap_auth File c:\web2py\gluon\custom_import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File c:\web2py\gluon\contrib\login_methods\ldap_auth.py, line 14, in module raise e What simple step am I missing? Thanks. -- --- 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/groups/opt_out.