OWASP/pytm

Enhancement request: move pyDAL to local import

colesmj opened this issue · 4 comments

pyDAL is used for only 1 purpose within 1 function - pytm.py:1175 SQLDump()
For readability and to reduce pre-installation requirements for likely most users, consider making the import of pyDAL currently on pytm.py:24 be local to SQLDump(). This is allowed by Python and means if no one uses SQLDump() pyDAL is never loaded; otherwise it is a requirement and always loaded even if never used.

hm, but wouldn't that cause a fail if someone started slow and didn't use the sql functionality, but then did so? we would be banking on the idea that they know how to deal with an import error in Python.

You can catch the failed import error and print guidance on how to proceed to stdout.

try:
    import pyDAL
except ImportError:
   print("please do ....")

... and I just learned a new one. This day already paid off, thanks!
In that case, PR away!

I think this can be closed now.