Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3792978

Browse files
committed
ensure __name__ == __main__
in autogen scripts run from conf.py
1 parent 8644c7f commit 3792978

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

docs/source/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
fname = 'autogen_{}.py'.format(name)
3131
fpath = os.path.abspath(os.path.join('..', fname))
3232
with open(fpath) as f:
33-
exec(compile(f.read(), fname, 'exec'), {'__file__': fpath})
33+
exec(compile(f.read(), fname, 'exec'), {
34+
'__file__': fpath,
35+
'__name__': '__main__',
36+
})
3437

3538
# If your extensions are in another directory, add it here. If the directory
3639
# is relative to the documentation root, use os.path.abspath to make it

0 commit comments

Comments
 (0)