gin-config icon indicating copy to clipboard operation
gin-config copied to clipboard

TypeError: 'zip' object is not subscriptable

Open Madhuparna04 opened this issue 5 years ago • 5 comments

This is the error summary

---> 32 import gin.tf 33 import numpy as np 34 import replay_memory

~/anaconda3/lib/python3.6/site-packages/gin/tf/init.py in 66 67 # pylint: disable=unused-import ---> 68 from gin.tf.utils import GinConfigSaverHook 69 70 # pylint: enable=g-import-not-at-top

~/anaconda3/lib/python3.6/site-packages/gin/tf/utils.py in 32 33 # Register TF file reader for Gin's parse_config_file. ---> 34 config.register_file_reader(tf.gfile.Open, tf.gfile.Exists) 35 36

~/anaconda3/lib/python3.6/site-packages/gin/config.py in register_file_reader(*args) 1412 return functools.partial(do_registration, is_readable_fn=args[0]) 1413 elif len(args) == 2: -> 1414 do_registration(*args) 1415 else: # 0 or > 2 arguments supplied. 1416 err_str = 'register_file_reader() takes 1 or 2 arguments ({} given)'

~/anaconda3/lib/python3.6/site-packages/gin/config.py in do_registration(file_reader_fn, is_readable_fn) 1406 """ 1407 def do_registration(file_reader_fn, is_readable_fn): -> 1408 if file_reader_fn not in list(zip(*_FILE_READERS))[0]: 1409 _FILE_READERS.append((file_reader_fn, is_readable_fn)) 1410

TypeError: 'zip' object is not subscriptable

1

How do I fix this?

Madhuparna04 avatar May 24 '19 22:05 Madhuparna04

Can anyone help me with this error?

Madhuparna04 avatar May 25 '19 10:05 Madhuparna04

Can you make sure that your TF version has tf.gfile.Open, tf.gfile.Exists?

sguada avatar May 28 '19 21:05 sguada

I have this same issue, and my TF version has tf.gfile.Open, tf.gfile.Exists

amyzhang avatar Jul 11 '19 22:07 amyzhang

It is probably related to using Python3 instead of 2 (see https://stackoverflow.com/questions/27431390/typeerror-zip-object-is-not-subscriptable ).

Cast the zip object into a list like list(zip(*_FILE_READERS))[0]

alexrakowski avatar Sep 26 '19 10:09 alexrakowski

@homaralex

Your reply truely helps.

GoingMyWay avatar Sep 30 '19 02:09 GoingMyWay