Skip to content

package.py doesn't get __file__ set #1338

Discussion options

You must be logged in to vote

__file__ isn't set because the package definitions are not imported using the Python import system. They are opened, read, compiled and then executed and the result is stored in a variable that contains all variables defined in the package definition.

def load_py(stream, filepath=None):

I have to tell you to be careful if you really want to add a __file__ variable. I don't think we can rely on the path of the definition file (package.py). For example a package can be moved from one repository to another (for archival purposes, multi-site transfers, etc), it could be locally cached or hell in the future could even live on somet…

Replies: 7 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by JeanChristopheMorinPerso
Comment options

You must be logged in to vote
4 replies
@JeanChristopheMorinPerso
Comment options

@JeanChristopheMorinPerso
Comment options

@anderslanglands
Comment options

@instinct-vfx
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@anderslanglands
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants