Skip to content

Tracing fails, if a program calls __main__.main #14

@AndreasGocht

Description

@AndreasGocht

When a tensorflow example uses tf.app.run() the tracing fails.

The reason is, that tf.app.run does the following [1]:

  main = main or _sys.modules['__main__'].main

  # Call the main function, passing through any arguments
  # to the final program.
_sys.exit(main(_sys.argv[:1] + flags_passthrough))

_sys.modules['__main__'].main calls the main of the tracing module. This brakes.

Possible solution:

import the target program and forward the call to target.main()

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions