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

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

Open
AndreasGocht opened this issue Aug 2, 2018 · 2 comments
Open

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

AndreasGocht opened this issue Aug 2, 2018 · 2 comments
Assignees
Labels

Comments

@AndreasGocht
Copy link
Collaborator

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()

@AndreasGocht AndreasGocht self-assigned this Aug 2, 2018
AndreasGocht added a commit that referenced this issue Sep 19, 2018
Add a suitable error messages if sys.modules['__main__'].main is called
This should help to identify the problem
AndreasGocht added a commit that referenced this issue Sep 19, 2018
* Add error message if #14 happens
    * Add a suitable error messages if sys.modules['__main__'].main is called This should help to identify the problem

* fix python2 error message error
@AndreasGocht
Copy link
Collaborator Author

I have no Idea how to call the original target.main().

I added an error message, which should help to address the problem manually. I think this is all I can do.

@AndreasGocht
Copy link
Collaborator Author

It might be that runpy can help here:
https://docs.python.org/3/library/runpy.html#runpy.run_path
This needs to be checked.

@AndreasGocht AndreasGocht reopened this Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant