Jump to content
  • Advertisement
Sign in to follow this  

Visual Studio + Makefiles Problem

This topic is 4518 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This might be a problem I'm having with Visual Studio (2005, Standard) or this might be a problem caused by a lack of familiarity with Python; I'm not really sure yet. Here's the situation: I have a .vcproj that is set to a "Makefile" configuration type, which means the build, rebuild and clean actions are specified as command line actions. I want to execute a Python script as the command line actions because I need to do some rather rich processing of the command line arguments and other processing that wouldn't be very fun inside a batch file. Ultimately, the Python script will invoke an external tool (SCONS) to perform the actual build. The problem I get is that I cannot correctly trap the output of the SCONS invocation. I've reduced the issue to a small test case for demonstration:
# This file is test.py
import os

print "Hello, world."
If I run test.py from a regular command prompt, I get the expected output (The hello string, and a directory listing). If I set "test.py" to be the build action for my Makefile project and try to build, I only see the "Hello, world." line in the output window. Something prevents system() from executing (it returns 1 when run from VS, 0 when run from a real shell; "del foo.txt" won't actually delete the file, etc.). My current workaround is to use popen to invoke the command and read back the output, but this is not suitable for actual use since I don't see any output until the popen'd command finishes (when used to actually invoke SCONS and build the project, this means it appears as nothing is happened for five minutes and then the build output is dumped all at once). Does anybody know why I'm not seeing results from os.system() or a good way to work around this problem?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!