Author anjos
Recipients anjos
Date 2017-04-26.08:53:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Apparently, "import site; site.main()" does not seem to work anymore on Python 3.6 and superior.

The reason is a change on the behavior of "os.path.abspath(None)". Before Python 3.6, it used to report an AttributeError which is properly caught inside "site.abs_paths" (see:, making it ignore __main__, one of sys.modules, which has __file__ and __cached__ set to None.

With Python 3.6 and superior, os.path.abspath(None) reports a TypeError, which makes calling "site.main()" raise an exception and stop.

How to reproduce: On python 3.6 or superior, do "import site; site.main()".

Expected behavior: Exception is properly caught and treated inside "site.abs_paths", ignoring modules in which __file__ and/or __cached__ are set to None.
Date User Action Args
2017-04-26 08:53:33anjossetrecipients: + anjos
2017-04-26 08:53:33anjossetmessageid: <>
2017-04-26 08:53:33anjoslinkissue30167 messages
2017-04-26 08:53:33anjoscreate