shuffle things around a bit

This commit is contained in:
Kenneth Reitz
2012-02-21 01:15:00 -05:00
parent 166c5a97fe
commit add958b068
23976 changed files with 0 additions and 0 deletions
@@ -0,0 +1 @@
[{"user_id": 21059, "stars": [], "topic_id": 39683, "date_created": 1308354480.5241239, "message": "If I have a python module, (example mymodule.py), how do I make it so I can launch from the command line with \"python myodule [args]\" or similar?", "group_id": 292, "id": 1423716}, {"user_id": 7376, "stars": [], "topic_id": 39683, "date_created": 1308359430.8153861, "message": "python mymodule.py [args]", "group_id": 292, "id": 1424074}, {"user_id": 7384, "stars": [], "topic_id": 39683, "date_created": 1308366303.9850979, "message": "I'm just learning too, but I think to access the args in your module you do 'import sys' and then they're in sys.argv", "group_id": 292, "id": 1424618}, {"user_id": 13806, "stars": [], "topic_id": 39683, "date_created": 1308368234.7010231, "message": "You might also be interested in the if __name__ == \"__main__\": trick :o) http://diveintopython.org/getting_to_know_python/testing_modules.html http://docs.python.org/tutorial/modules.html#executing-modules-as-scripts", "group_id": 292, "id": 1424751}, {"user_id": 21122, "stars": [], "topic_id": 39683, "date_created": 1308377837.6732509, "message": "And if, rather, the module you want to run is on your python path (sys.path), such as a built-in or installed module, you can run it like a script from the command line with \"python -m [module] [args]\". (When I want to run globally-installed pylint with a virtualenv python, it's \"python -m pylint.lint [file]\".)", "group_id": 292, "id": 1425261}, {"user_id": 8433, "stars": [{"date_created": 1308409699.9640579, "user_id": 8391}, {"date_created": 1308429318.962575, "user_id": 5778}], "topic_id": 39683, "date_created": 1308400020.1478119, "message": "You might want to take a look at Clint -- it makes some things easier when you're dealing with command line arguments. https://github.com/kennethreitz/clint", "group_id": 292, "id": 1426234}, {"user_id": 21059, "stars": [], "topic_id": 39683, "date_created": 1308406543.84342, "message": "@jesteria I think that's what I'm looking for. Thanks.", "group_id": 292, "id": 1426814}, {"user_id": 8391, "stars": [], "topic_id": 39683, "date_created": 1308409716.8672891, "message": "@BryanBurke thanks ;) I need to document it today.", "group_id": 292, "id": 1427089}]