I have this line of code in my main.py:
if __name__ == "__main__": tf.app.run()
But this throws an exception:
ValueError: Iteration of zero-sized operands is not enabled
Why is this?
This is all the code:
import tensorflow as tf import config import os from urllib.request import urlretrieve from zipfile import ZipFile from dataset.dataset import Dataset from network.eval import Learning FLAGS = tf.app.flags.FLAGS data_dir = config.data_dir tmp_zip_adr = config.tmp_zip_adr dataset_urls = config.dataset_urls def download_dataset_if_needed(): def download_and_unzip(zipurls): for url in zipurls: print("Downloading {}".format(url)) fpath, _ = urlretrieve(url, tmp_zip_adr) zf = ZipFile(fpath) zf.extractall(data_dir) zf.close() os.remove(fpath) print("Dataset downloaded into 'dataset/data' folder") if not os.path.exists(data_dir) or FLAGS.download: os.makedirs(data_dir) print("Downloading dataset") download_and_unzip(dataset_urls) def main(argv=None): download_dataset_if_needed() if FLAGS.update or not os.path.exists(data_dir + 'segmented_set1'): print("Starting processing binary dataset") Dataset().create_dataset(data_dir + "segmented_set?/*.avi") Learning() if __name__ == '__main__': tf.app.run()
And this is the whole mistake:
Traceback (most recent call last): File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\main.py", line 41, in <module> tf.app.run() File "C:\Users\asus\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\main.py", line 37, in main Learning() File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\network\eval.py", line 12, in __init__ self.train_reader = Reader.Reader("dataset/data/segmented_set1/*.tfr") File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\dataset\Reader.py", line 13, in __init__ self.init_dataset() File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\dataset\Reader.py", line 53, in init_dataset self.iterator = np.nditer(self.files) ValueError: Iteration of zero-sized operands is not enabled
I went through tf.app.run () on a line using the code found at https://github.com/tensorflow/tensorflow/blob/9dc6c17797c065796603d9259b2aa57b3c07ff71/tensorflow/python/platform/app.py#L22 , and that line in run(main=None, argv=None)
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
gives an error message
Traceback (most recent call last): File "<pyshell#48>", line 1, in <module> _sys.exit(main(_sys.argv[:1] + flags_passthrough)) TypeError: 'NoneType' object is not callable
python exception error-handling tensorflow
Chaine Jun 27 '17 at 6:12 2017-06-27 06:12
source share