Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 840af1f

Browse files
committed
Fix for missing global name __file__
1 parent 6b280d8 commit 840af1f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sqlmap.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
import bdb
9+
import inspect
910
import logging
1011
import os
1112
import sys
@@ -50,7 +51,12 @@ def modulePath():
5051
using py2exe
5152
"""
5253

53-
return os.path.dirname(os.path.realpath(getUnicode(sys.executable if weAreFrozen() else __file__, sys.getfilesystemencoding())))
54+
try:
55+
_ = sys.executable if weAreFrozen() else __file__
56+
except NameError:
57+
_ = inspect.getsourcefile(modulePath)
58+
59+
return os.path.dirname(os.path.realpath(getUnicode(_, sys.getfilesystemencoding())))
5460

5561
def main():
5662
"""

0 commit comments

Comments
 (0)