- Home /
Python PostprocessBuildPlayer script for Windows
Hi, I'm looking into setting up a build counter, and one of the ways that I have seen to do this is to write a Python script that runs after you build the player. What I'm wondering is, is there anything in particular you need to do to get this running? I have a script that does the work I want it to, but I can't seem to make it work with the PostprocessBuildPlayer setup.
Are there any particular things that need to be in the script to make it run? Is there any particular setup that Python will need to let this run (it works fine, as I said, when there is an extension .py on it, but not when there is no extension)?
Any and all ideas/solutions are great. I am only using Unity, not Pro or iPhone, so hopefully this is doable there.
Thanks.
Answer by Cyclops · Mar 19, 2010 at 09:11 PM
For Windows, yes, Windows does not use #!/filepath. And it does require extensions to associate file types with their executable.
"When you double-click a file to open it, Windows XP examines the file name extension. If Windows XP recognizes the file name extension, it opens the file in the program that is associated with that file name extension." Windows XP Extensions
This next paragraph, may or may not be related to the question. It is possible to change how you call the file (on a Command Line), through the Windows PATHEXT variable. Here's an article that explains it:
Using Python Scripts without .py
So before you would need to type:
C> someScript.py
You could type instead:
C> someScript
So, in the unlikely event that your script isn't being called because Unity strips off the .py, this might fix it. :)
Answer by andeeee · Feb 19, 2010 at 01:17 PM
Is it possible that the .py extension is the only thing that identifies the file as a Python script? I can't remember if Windows use the "shebang" #!/filepath line to state which tool to use or something similar.
Windows cannot use that form, it relies entirely on extension. I've seen that this has been bugged and discussed in the forums for the last 2 years... do we have an update on this?