Invoking scons from a Python script

I'm new to scons and Python. I was wondering if there's a way to invoke scons from within a python script. My python script accepts from the user, a list of directories where the code to be compiled together is located (in addition to doing some other non-trivial things). It also generates a string which is to be used as a name of the executable created by scons. I want to pass this

从Python脚本调用scons

我对scons和Python很陌生。 我想知道是否有方法从python脚本中调用scons。 我的python脚本从用户接受要编译在一起的代码所在的目录列表(除了做一些其他不重要的事情之外)。 它还会生成一个字符串,用作scons创建的可执行文件的名称。 我想将这些信息从我的python脚本传递给scons,然后调用scons。 有没有简单的方法来做到这一点? 我可以想到以下可能性: 使用subprocess.call("scons"...)我不确定scons

Scons Hierarchical Builds with Repository directory

I have an SCons project set up as follows: proj/ SConstruct src/ c/ h/ app1/SConscript app2/SConscript ... All source/header files for each application are located in src/c and src/h. At first step I created a SConstruct in app1 which use the Repository function. ... src=Split("main.c first.c second.c") env = Environment(CC='g++', CC

Scons Hierarchical与存储库目录构建

我有一个SCons项目设置如下: proj/ SConstruct src/ c/ h/ app1/SConscript app2/SConscript ... 每个应用程序的所有源/头文件都位于src / c和src / h中。 在第一步中,我在app1中使用Repository函数创建了一个SConstruct。 ... src = Split(“main.c first.c second.c”) env = Environment(CC ='g ++',CCFLAGS = [' - O0','-ggdb'],CPPPATH = [&

Oracle install within PyDev

I am on Windows 10 Pro 64-bit Anniversary Edition using Python 3.5.2 (Anaconda 4.1.1). I download the latest Oracle 12c Instant Client instantclient-basic-windows.x64-12.1.0.2.0.zip and instantclient-sdk-windows.x64-12.1.0.2.0.zip into C:instantclient and put C:instantclient on my PATH . Then I download the installer cx_Oracle-5.2.1-12c.win-amd64-py3.5.exe directly from PyPI . Now I can start

Oracle在PyDev中安装

我在使用Python 3.5.2(Anaconda 4.1.1)的Windows 10 Pro 64位周年纪念版上。 我将最新的Oracle 12c即时客户端instantclient-basic-windows.x64-12.1.0.2.0.zip和instantclient-sdk-windows.x64-12.1.0.2.0.zip到C:instantclient ,并将C:instantclient在我的PATH 。 然后我直接从PyPI下载安装程序cx_Oracle-5.2.1-12c.win-amd64-py3.5.exe 。 现在我可以启动一个Anaconda python提示符并键入import cx_Oracle并且它是成功

Pydev Not Recognized in Eclipse

I've been using PyDev within Eclipse on my Mac for about two years now. Updated Eclipse today, and suddenly PyDev is completely missing. Tried everything, included a complete uninstall and fresh install, but although PyDev shows up as installed in the menu, it appears nowhere else. PyDev version: 3.0.0.201311051910 Eclipse: Version: Kepler Service Release 1 Build id: 20130919-0819 I can

Eclipse中没有识别Pydev

我在Mac上的Eclipse中使用PyDev已有两年多了。 今天更新了Eclipse,并且PyDev突然完全缺失。 尝试了一切,包括一个完整的卸载和全新安装,但尽管PyDev显示为安装在菜单中,但它看起来没有其他地方。 PyDev版本:3.0.0.201311051910 Eclipse:版本:Kepler Service Release 1 Build ID:20130919-0819 我无法打开PyDev透视图,我无法创建新的Python文件,也无法打开现有的Python文件,而只是将其视为纯文本。 今晚我有一

PyDev eclipse shows compile error red marks , but runs fine?

The following code is auto-generated by PyDev eclipse plugin, by choosing "new --> PyDev project" , new "PyDev Module", then choose "Unittest" but on eclipse editor, it shows a red mark on "import unittest", saying that the module can not be imported. but this thing runs fine. I am using python 2.7 and eclipse 3.6 ''' Created on Dec 12, 2012 @autho

PyDev eclipse显示编译错误红色标记,但运行良好?

以下代码由PyDev eclipse插件自动生成,方法是选择“新建 - > PyDev项目”,新建“PyDev模块”,然后选择“单元测试” 但在eclipse编辑器中,它在“import unittest”上显示一个红色标记,表示该模块无法导入。 但这件事情运行良好。 我正在使用python 2.7和eclipse 3.6 ''' Created on Dec 12, 2012 @author: yang ''' import unittest class Test(unittest.TestCase): def testName(self): pass if __name__

Importing using pydev and .pth files

related to: Unresolved Import Issues with PyDev and Eclipse Recently I moved my django package to django_trunk so I can have a development version elsewhere. I have no issue importing django, runserver, or any of that. My issue (annoyance?) is that all of the imports are coming up as underscored red indicating an error. Pydev clearly knows of the imports, but for whatever reason it still i

使用pydev和.pth文件导入

涉及:未解决的PyDev和Eclipse导入问题 最近我将我的django软件包移到了django_trunk中,这样我就可以在其他地方使用开发版了。 我没有导入django,runserver或其他任何问题。 我的问题(烦恼?)是,所有的进口都会显示为红色,表明有错误。 Pydev清楚地知道进口,但无论出于何种原因,它仍然以红色进口。 我已经注意到这与其他一些软件包,它使用.pth文件,而不是直接导入。 在过去,我只是忽略了红色,但与Django它

Python mysqldb: Library not loaded: libmysqlclient.18.dylib

I just compiled and installed mysqldb for python 2.7 on my mac os 10.6. I created a simple test file that imports import MySQLdb as mysql Firstly, this command is red underlined and the info tells me "Unresolved import". Then I tried to run the following simple python code import MySQLdb as mysql def main(): conn = mysql.connect( charset="utf8", use_unicode=True, host="localho

Python mysqldb:未加载库:libmysqlclient.18.dylib

我在我的Mac OS 10.6上编译并安装了python 2.7的mysqldb。 我创建了一个简单的导入测试文件 import MySQLdb as mysql 首先,这个命令是红色下划线的,信息告诉我“未解析的导入”。 然后我尝试运行以下简单的Python代码 import MySQLdb as mysql def main(): conn = mysql.connect( charset="utf8", use_unicode=True, host="localhost",user="root", passwd="",db="" ) if __name__ == '__main__'(): main() 执行

If Python is interpreted, what are .pyc files?

I've been given to understand that Python is an interpreted language... However, when I look at my Python source code I see .pyc files, which Windows identifies as "Compiled Python Files". Where do these come in? They contain byte code, which is what the Python interpreter compiles the source to. This code is then executed by Python's virtual machine. Python's document

如果解释Python,什么是.pyc文件?

我已经了解到Python是一种解释型语言......但是,当我查看我的Python源代码时,我看到了Windows标识为“编译的Python文件”的.pyc文件。 这些进来了? 它们包含字节代码,这是Python解释器编译源代码的地方。 这段代码然后由Python的虚拟机执行。 Python的文档解释了这样的定义: Python是一种解释型语言,与编译型语言相反,但由于字节码编译器的存在,区别可能会很模糊。 这意味着源文件可以直接运行,而无需显式创建一

How do I fix PyDev "Undefined variable from import" errors?

I've got a Python project using PyDev in Eclipse, and PyDev keeps generating false errors for my code. I have a module settings that defines a settings object. I import that in module b and assign an attribute with: from settings import settings settings.main = object() In some of my code--but not all of it, statements like: from settings import settings print settings.main ... generat

如何解决PyDev“导入时未定义的变量”错误?

我有一个在Eclipse中使用PyDev的Python项目,PyDev不断为我的代码生成错误的错误。 我有一个定义settings对象的模块settings 。 我在模块b导入它,并为其分配一个属性: from settings import settings settings.main = object() 在我的一些代码中 - 但不是全部,代码如下所示: from settings import settings print settings.main ...在Eclipse代码错误窗格中生成“来自import:main的未定义变量”消息,即使代码运行没有

pydev issue with gobject

It seems that Pydev (1.5.4) on Eclipse (3.5.1) with Python 2.6 isn't able to correctly cross-reference the package gobject . Putting import gobject works OK but any more than that (eg class X(gobject.GObject) causes Pydev to report "unresolved reference" errors. What could be the problem? Note that every other package I use doesn't trigger this error. The issue is related

python与gobject问题

看来Eclipse(3.5.1)和Python 2.6上的Pydev(1.5.4)无法正确地交叉引用软件包gobject 。 把import gobject工作正常,但除此之外(例如class X(gobject.GObject)导致Pydev报告“未解决的引用”错误。 可能是什么问题呢? 请注意,我使用的每个其他软件包都不会触发此错误。 这个问题与PyDev的这个限制有关: 我安装了一个库,Pydev没有找到它 那么,在Mac和Linux上已经报告了问题,主要原因似乎是符号链接。 Pydev只