Re: [web2py] How to try - exception - finally os.path.join

14 views
Skip to first unread message

Christian Varas

unread,
Jul 3, 2019, 5:29:14 PM7/3/19
to web...@googlegroups.com
What about
try:
        file_location = os.path.join(request.folder, 'views','plot')
        
 except Exception as error:
    print (error)

El lun., 1 de jul. de 2019 23:47, Quang Lam <mrry...@csu.fullerton.edu> escribió:
Hi All, i try to do the try - exception - finally for os.path.join how somehow it does not catch the error. Please help

 try:
        file_location = os.path.join(request.folder, 'views','plot')
        raise OSError
    except OSError as error:
    print (error)

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/bd443e12-6318-46ae-a8c9-6228e15e3a21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Val K

unread,
Jul 3, 2019, 7:28:24 PM7/3/19
to web2py-users
Just in case: os.path.join does not check that path exists, so what kind of error are you trying to catch?
Reply all
Reply to author
Forward
0 new messages