下記のようなコードに対し、エラーが出ましたこれはどういうエラーでしょうか?
参考:tensor flow始めました
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import tensorflow as tf
from PIL import Image
from reader import Cifar10Reader
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('file', None, "処理するファイルのパス")
tf.app.flags.DEFINE_integer('offset', 0, "読み飛ばすレコード数")
tf.app.flags.DEFINE_integer('length', 16, "読み込んで変換するレコード数")
baseename = os.path.basename(FLAGS.file)
path = os.path.dirname(FLAGS.file)
reader = Cifar10Reader(FLAGS.file)
stop =FLAGS.offset + FLAGS.length
for index in range(FLAGS.offset, stop):
image = reader.red(index)
print('label: %d' % image.label)
imageshow = Image.formarray(image.byte_array.astype(np.uint8))
file_name = '%s-%02d-%d.png' % (basename, index, image.label)
fole = os.path.join(path, file_name)
with open(file, mode='wb') as out:
imageshow.save(out, format='png')
reader.close()
ArgumentError Traceback (most recent call last)
<ipython-input-18-9a5ff25e4587> in <module>()
1 FLAGS = tf.app.flags.FLAGS
----> 2 tf.app.flags.DEFINE_string('file', None, "処理するファイルのパス")
3 tf.app.flags.DEFINE_integer('offset', 0, "読み飛ばすレコード数")
4 tf.app.flags.DEFINE_integer('length', 16, "読み込んで変換するレコード数")
5
~/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/platform/flags.py in DEFINE_string(flag_name, default_value, docstring)
78 docstring: A helpful message explaining the use of the flag.
79 """
---> 80 _define_helper(flag_name, default_value, docstring, str)
81
82
~/anaconda/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/platform/flags.py in _define_helper(flag_name, default_value, docstring, flagtype)
63 default=default_value,
64 help=docstring,
---> 65 type=flagtype)
66
67
~/anaconda/envs/tensorflow/lib/python3.5/argparse.py in add_argument(self, *args, **kwargs)
1342 raise ValueError("length of metavar tuple does not match nargs")
1343
-> 1344 return self._add_action(action)
1345
1346 def add_argument_group(self, *args, **kwargs):
~/anaconda/envs/tensorflow/lib/python3.5/argparse.py in _add_action(self, action)
1705 def _add_action(self, action):
1706 if action.option_strings:
-> 1707 self._optionals._add_action(action)
1708 else:
1709 self._positionals._add_action(action)
~/anaconda/envs/tensorflow/lib/python3.5/argparse.py in _add_action(self, action)
1546
1547 def _add_action(self, action):
-> 1548 action = super(_ArgumentGroup, self)._add_action(action)
1549 self._group_actions.append(action)
1550 return action
~/anaconda/envs/tensorflow/lib/python3.5/argparse.py in _add_action(self, action)
1356 def _add_action(self, action):
1357 # resolve any conflicts
-> 1358 self._check_conflict(action)
1359
1360 # add to actions list
~/anaconda/envs/tensorflow/lib/python3.5/argparse.py in _check_conflict(self, action)
1495 if confl_optionals:
1496 conflict_handler = self._get_handler()
-> 1497 conflict_handler(action, confl_optionals)
1498
1499 def _handle_conflict_error(self, action, conflicting_actions):
~/anaconda/envs/tensorflow/lib/python3.5/argparse.py in _handle_conflict_error(self, action, conflicting_actions)
1504 for option_string, action
1505 in conflicting_actions])
-> 1506 raise ArgumentError(action, message % conflict_string)
1507
1508 def _handle_conflict_resolve(self, action, conflicting_actions):
ArgumentError: argument --file: conflicting option string: --file