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

Skip to content

Commit e54e726

Browse files
committed
SF patch #1038388: __main__ for whichdb.py
(Contributed by Oleg Broytmann.)
1 parent 76e60d6 commit e54e726

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/whichdb.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# !/usr/bin/env python
12
"""Guess which db package to use to open a db file."""
23

34
import os
@@ -110,3 +111,7 @@ def whichdb(filename):
110111

111112
# Unknown
112113
return ""
114+
115+
if __name__ == "__main__":
116+
for filename in sys.argv[1:]:
117+
print whichdb(filename) or "UNKNOWN", filename

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Extension Modules
2222
Library
2323
-------
2424

25+
- The whichdb module can now be run from the command line.
26+
2527
- Bug #1045381: time.strptime() can now infer the date using %U or %W (week of
2628
the year) when the day of the week and year are also specified.
2729

0 commit comments

Comments
 (0)