Post by Todd WidupexFile=namedtuple("filePath","path, file")
path=None
name=None
frame=sys._getframe(1)
fil=frame.f_code.co_filename
path,name=os.path.split(fil)
return exFile(path,name)
thats the code I am running in a util.py file that is called by core.py
in core.py is where it seems to get hard coded to the path I have things
sourced from
Given that a pyc file has all of its code objects compiled and serialized
up front, and that its primary purpose is to optimize subsequent runs of
the program as opposed to be used as a distribution format, I suppose it
shouldn't be surprising that the filename has already been evaluated and
marshalled as part of the code object. It is meant to make sense and be
accurate when debugging is performed against the pyc file that lives in the
original location relative to the source file. So we could say that while
it should work to distribute pyc files to users of the same platform and
python version, one could expect certain debugging aspects to not work
properly.
Is the intent of this function to get the filename of the module that is
the caller of getExecutingfile() (one stack frame back, for debugging
purposes)? If so, does this approach work?
sys._getframe(1).f_globals['__file__']
At least this approach isn't referring to the already-compiled code
objects, and is looking at the globals for the frame.
Justin
Post by Todd WidupPost by Justin IsraelPost by Todd Widupso I have a few tools I gave over to a friend..gave them the PYC files.
part of what one of the tools does is get the directory path it was
executed from to pass along.
anyways, my friend that was running it, kept getting some errors about a
path not existing...strange thing was, it was showing the path where I have
the tools on my local machine, not where he has them.
so...do PYC files store info like that? I always thought it was
strictly a compiled version of the py file, with nothing else
Do you have an example of what kind of code was returning a cached result
from when the pyc was generated?
Post by Todd Widup--
Todd Widup
Creature TD / Technical Artist
--
You received this message because you are subscribed to the Google
Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CABBPk36XUNP2PqWnGaq5wgRdrQH%3DgmYf_v%2BmLQi171VbFS5-GA%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CABBPk36XUNP2PqWnGaq5wgRdrQH%3DgmYf_v%2BmLQi171VbFS5-GA%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
Post by Justin Israelhttps://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1NzFWJ5o1%3DAFqK1mc%2Bsf%3DETiw8-s_zt3pZt2rWbJKR2w%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1NzFWJ5o1%3DAFqK1mc%2Bsf%3DETiw8-s_zt3pZt2rWbJKR2w%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Todd Widup
Creature TD / Technical Artist
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CABBPk37XaXLxC6NeMXL0MoqF9NjR5U4zd0YWN64mfrv8G8_b8g%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CABBPk37XaXLxC6NeMXL0MoqF9NjR5U4zd0YWN64mfrv8G8_b8g%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1BXzHec6o54JRJpHT%3Dh410zuygGkqWEt%3DANh5ba5OUZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.