Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'zip' object is not subscriptable #22

Open
Madhuparna04 opened this issue May 24, 2019 · 5 comments
Open

TypeError: 'zip' object is not subscriptable #22

Madhuparna04 opened this issue May 24, 2019 · 5 comments

Comments

@Madhuparna04
Copy link

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
Copy link
Author

Can anyone help me with this error?

@sguada
Copy link
Collaborator

sguada commented May 28, 2019

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

@amyzhang
Copy link

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

@alexrakowski
Copy link

alexrakowski commented Sep 26, 2019

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]

@GoingMyWay
Copy link

@homaralex

Your reply truely helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants