Skip to content

Commit 24f8466

Browse files
MarredCheeseigrr
authored andcommitted
fixed argument passing (esp8266#2209)
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.
1 parent 4217e49 commit 24f8466

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/espota.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Changes
2222
# 2015-11-09:
2323
# - Added digest authentication
24-
# - Enchanced error tracking and reporting
24+
# - Enhanced error tracking and reporting
2525
#
2626
# Changes
2727
# 2016-01-03:
@@ -199,7 +199,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
199199
# end serve
200200

201201

202-
def parser():
202+
def parser(unparsed_args):
203203
parser = optparse.OptionParser(
204204
usage = "%prog [options]",
205205
description = "Transmit image over the air to the esp8266 module with OTA support."
@@ -275,15 +275,15 @@ def parser():
275275
)
276276
parser.add_option_group(group)
277277

278-
(options, args) = parser.parse_args()
278+
(options, args) = parser.parse_args(unparsed_args)
279279

280280
return options
281281
# end parser
282282

283283

284284
def main(args):
285285
# get options
286-
options = parser()
286+
options = parser(args)
287287

288288
# adapt log level
289289
loglevel = logging.WARNING

0 commit comments

Comments
 (0)