Skip to content

Commit

Permalink
fixed argument passing (esp8266#2209)
Browse files Browse the repository at this point in the history
Using espota.py as a module by calling espota.main(args) was not working because the args given to main were not being passed into parser.parse_args().  I fixed this by having main pass args to the parser function, which in turn passes them to the parser object's parse_args() function.
  • Loading branch information
MarredCheese authored and igrr committed Jul 6, 2016
1 parent 4217e49 commit 24f8466
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/espota.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Changes
# 2015-11-09:
# - Added digest authentication
# - Enchanced error tracking and reporting
# - Enhanced error tracking and reporting
#
# Changes
# 2016-01-03:
Expand Down Expand Up @@ -199,7 +199,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
# end serve


def parser():
def parser(unparsed_args):
parser = optparse.OptionParser(
usage = "%prog [options]",
description = "Transmit image over the air to the esp8266 module with OTA support."
Expand Down Expand Up @@ -275,15 +275,15 @@ def parser():
)
parser.add_option_group(group)

(options, args) = parser.parse_args()
(options, args) = parser.parse_args(unparsed_args)

return options
# end parser


def main(args):
# get options
options = parser()
options = parser(args)

# adapt log level
loglevel = logging.WARNING
Expand Down

0 comments on commit 24f8466

Please sign in to comment.