Skip to content

Commit

Permalink
Move argument handling code to main()
Browse files Browse the repository at this point in the history
Otherwise it is not executed when run through the setup.py entry script
hook.
  • Loading branch information
dbrgn committed Jan 8, 2016
1 parent 6105257 commit e252c84
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions orochi/client.py
Expand Up @@ -807,21 +807,22 @@ def help_uf(self):


def main():
client = Client()
client.cmdloop()

if __name__ == '__main__':

# Handle version printing
if '-v' in sys.argv or '--version' in sys.argv:
print('%s v%s' % (meta.title, meta.version))
sys.exit(0)

try:
main()
except Exception as ex:
client = Client()
client.cmdloop()
except Exception:
if '--pdb' in sys.argv:
import pdb
pdb.set_trace()
else:
raise


if __name__ == '__main__':
main()

0 comments on commit e252c84

Please sign in to comment.