1

I am having a problem while playing the following code given as example in Cleverhans Library :

The problem is on Line # 18 . When it plays it gives out an import error :

ImportError: cannot import name 'flags'

I have tried to see in the help and there is also no flags function listed there.

from cleverhans.compat import flags

This should work by simply importing the module and giving no error.

blackbrandt
  • 2,010
  • 1
  • 15
  • 32
Inaam Ilahi
  • 105
  • 2
  • 9

3 Answers3

1

I found the solution.

If any such error appears then its due to the problem in the way you have set your environment to work in .

If the dependencies are perfectly aligned then there comes no such error.

Thanks :)

P.S. If you find such error while running your code in Cleverhans then drop me a message . I'll be happy to help :)

Inaam Ilahi
  • 105
  • 2
  • 9
1

To anyone that needs a solution: replace from cleverhans.compat import flags with from tensorflow.python.platform import flags

  • i did try that too . This error gets resolved but there are other multiple errors that come . Anyways thanks for contributing :) – Inaam Ilahi Jan 20 '19 at 10:28
0

if you are using pycharm, maybe you should open all the project 'cleverhans-master', and right-click on it,select mark directory as---source root. And it could be imported normally.

maggie
  • 1