I am getting the error below if i import http.client

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File "G:\my web2py project\gluon\restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "G:/my web2py
project/applications/smsonline/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/smsonline/controllers/default.py>,
line 6, in <module>
    import http.client
  File "G:\my web2py project\gluon\custom_import.py", line 104, in
custom_importer
    raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ImportError("Cannot import module
'applications.smsonline.modules.http'",), <traceback object at
0x07E97A58>)

Error snapshot [image: help]
<http://127.0.0.1:8000/admin/default/ticket/smsonline/127.0.0.1.2018-09-25.12-29-05.e85da1d3-2a65-4bc5-9dbe-8bf18a9c3db3#>

<type 'exceptions.ImportError'>((ImportError("Cannot import module
'applications.smsonline.modules.http'",), <traceback object at 0x07E97A58>))

On Mon, 24 Sep 2018 at 08:49, Nico de Groot <ndegro...@gmail.com> wrote:

>  You can just use the import statement. Web2py code is just Python code
> running in a web environment. Just know that at every web request all model
> files are executed, and after that the controller file that corresponds
> with the URL of the request. The view file with the same name is used to
> produce the HTML to return.
> So you can put the code in the controller
>
> >>> import http.client
> >>> conn = http.client.HTTPSConnection("www.python.org")
> >>> conn.request("GET", "/")
> >>> r1 = conn.getresponse()
>
> Note that the Requests library is easier to use.
>
> --
> 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.

Reply via email to