473,574 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

distutils problem windows xp python 2.4.2

Hello I tried to combine c++ and python together.
So I follow from this website:
http://kortis.to/radix/python_ext/

I have this code:
# prmodule.c
static PyObject *pr_isprime(PyO bject *self, PyObject *args){
int n, input;

if (!PyArg_ParseTu ple(args, "i", &input))
return NULL;

if (input < 1) {
return Py_BuildValue(" i", 0);
}

n = input - 1;

while (n > 1){
if (input%n == 0) return Py_BuildValue(" i", 0);;
n--;
}

return Py_BuildValue(" i", 1);
}

static PyMethodDef PrMethods[] = {
{"isprime", pr_isprime, METH_VARARGS, "Check if prime."},
{NULL, NULL, 0, NULL}
};

void initpr(void){
(void) Py_InitModule(" pr", PrMethods);
}

and my setup.py file:
from distutils.core import setup, Extension
module = Extension('pr', sources = ['prmodule.c'])
setup(name = 'Pr test', version = '1.0', ext_modules = [module])

------------------------------------
If I run setup build
I've got the following error message
running build
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

I use visual Studio 2005.

Thanks,
pujo

Dec 4 '05 #1
6 2337
aj****@gmail.co m wrote:
Hello I tried to combine c++ and python together.
So I follow from this website:
http://kortis.to/radix/python_ext/
....
and my setup.py file:
from distutils.core import setup, Extension
module = Extension('pr', sources = ['prmodule.c'])
setup(name = 'Pr test', version = '1.0', ext_modules = [module])

------------------------------------
If I run setup build
I've got the following error message
running build
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

I use visual Studio 2005.

Thanks,
pujo

You might take a look at:

http://groups.google.com/group/comp....2?dmode=source

it provides code to change your setup code to:
from distutils.core import setup, Extension
module = Extension('pr', sources = ['prmodule.c'])

for attempts in range(2):
try:
setup(name='Pr test',
version='1.0',
ext_modules=[module])
except SystemExit, e: pass # Failure. Patch and try again
else: break # Successful run, no need to retry.

print '*** Apparently a failure:', e.args[0]
print '*** Patching and trying again'
import patch_msvccompi ler

--Scott David Daniels
sc***********@a cm.org
Dec 4 '05 #2
Hello Scott,

It didn't work with visual studio 5. .Net framework 2.0
Do you have any suggestions?

Thanks,
pujo

Dec 4 '05 #3
aj****@gmail.co m wrote:
It didn't work with visual studio 5. .Net framework 2.0
Do you have any suggestions?


"It didn't work" is not very diagnosable.

--Scott David Daniels
sc***********@a cm.org
Dec 4 '05 #4
Hello,

It give the same error result:
D:\testprogram\ distutils problem>setup build
running build
running build_ext
*** Failed: error: The .NET Framework SDK needs to be installed before
building extensions for Python.
Attempting to patch distutils.msvcc ompiler and retry:
running build
running build_ext
*** Failed: error: The .NET Framework SDK needs to be installed before
building extensions for Python.
Attempting to patch distutils.msvcc ompiler and retry:

This is inside my setup.py
#from distutils.core import setup, Extension
#
#module = Extension('pr', sources = ['prmodule.c'])
#setup(name = 'Pr test', version = '1.0', ext_modules = [module])
#

__version__ = '0.3'

from distutils.core import setup, Extension

for attempts in range(2):
try:
setup(name='Pr test', version='1.0',
ext_modules=[Extension('pr', ['prmodule.c'])])
except SystemExit, e:
print '*** Failed:', e.args[0]
else:
break # Successful (avoid the retry)
print 'Attempting to patch distutils.msvcc ompiler and retry:'

import distutils.msvcc ompiler

class BatReader(objec t):
def __init__(self, batch_filename) :
self.source = open(batch_file name, 'rU')

def getsets(self):
'''Get all command lines which are "SET" commands.'''
self.source.see k(0)
for line in self.source:
try: command, rest = line.split(None , 1)
except ValueError: continue # Set a=b splits fine
if command.lower() == 'set':
try: key, value = rest.split('=', 1)
except ValueError: continue # breaking a=b;c;d
elif command.lower() == 'path':
key, value = command, rest #path x == set path=x
yield key, value.rstrip()

def paths(self, pathkey):
'''Find the file paths using our getsets methods.'''
keyed = pathkey.upper()
for key, paths in self.getsets():
if key.upper() == keyed:
elements = paths.split(';' )
if elements[-1].upper() == keyed.join('%%' ):
return elements[: -1]
return elements

class MSVCCompiler(di stutils.msvccom piler.MSVCCompi ler):
_patho = BatReader(r'C:\ Program Files\Microsoft Visual Studio
8\VC\bin\vcvars 32.bat') # or vcvars32.bat or ...
def get_msvc_paths( self, path, platform='x86') :
if path == 'library': path = 'lib'
return self._patho.pat hs(path)

distutils.msvcc ompiler.MSVCCom piler = MSVCCompiler
# OK, patched it, now go try again.

Yours,
pujo

Dec 5 '05 #5
aj****@gmail.co m wrote:
....
*** Failed: error: The .NET Framework SDK needs to be installed before
building extensions for Python.

....
It is so much easier with the actual error messages.

Ah-ha -- you installed the compiler but not the .NET Framework.
You have more downloading and installing to do.

See, for example:
http://www.vrplumber.com/programming/mstoolkit/

--Scott David Daniels
sc***********@a cm.org
Dec 5 '05 #6
Hello,

I have .net framework 2.0 because I' already able to run visual studio
express 2005.
Should I install .net framework 1.1 and also ms toolkit ?

Sincerely Yours,
pujo

Dec 6 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1564
by: Andrew Gregory | last post by:
In Python 2.2, I compiled some C++ code on Windows (MinGW compiler) to create an extension using distutils and the following setup.py file: from distutils.core import setup, Extension setup (name = "_pysimple", version = "1.0", maintainer = "AG", maintainer_email = "xxx@xx.co.uk", description = "Sample Python C++ DLL", ext_modules = ,
1
2793
by: Peter Schmiedeskamp | last post by:
Hello, I'm writing in regard to the distutils package for python. I regularly repackage installers for silent/automated distribution on numerous Windows PCs throughout an enterprise. Sites such as AppDeploy (http://www.appdeploy.com) and tools such as WISE all suggest that this is a pretty common task. Increasingly, however, I've found...
5
1870
by: Lonnie Princehouse | last post by:
I'm in a situation where I need to distribute several interdependent Python packages. There are good reasons not to combine them all into one package. Distutils doesn't seem to be able to bundle a heterogeneous mix of multiple packages and modules, and so I've currently got people launching three installers in the proper sequence in order...
15
4110
by: Colin J. Williams | last post by:
The distutils download page has: -------------------------------------------------------- Current stable release The current stable release is Distutils 1.0.2; you can download it as: * Distutils-1.0.2.tar.gz (source distribution) (233k) * Distutils-1.0.2.zip (source distribution) (274k) * Distutils-1.0.2.win32.exe (Windows installer)...
5
2665
by: Fuzzyman | last post by:
Python 2.4 is built with Microsoft Visiual C++ 7. This means that it uses msvcr7.dll, which *isn't* a standard part of the windows operating system. This means that if you build a windows installer using distutils - it *requires* msvcr7.dll in order to run. This is true even if your package is a pure python package. This means that when...
0
1443
by: Glenn Pierce | last post by:
Hi I have a question about writing a portable setup.py script for distutils. I have a directory structure like this. FreeImage/ |----------Source/ | |------ FreeImage.h | |----------Dist/ | |------FreeImage.lib
1
2145
by: George van den Driessche | last post by:
Hi folks, I'm looking at packaging a project I'm working on using distutils. The project is for Windows and contains a COM server which needs registration, so the installer needs to be a little more complicated than usual. Looking at the options for the bdist_wininst command to distutils, I see it's possible to specify...
9
4145
by: jtravs | last post by:
Hi all, I suspect that I'm doing something stupid, I would like some other opinions though. I'm getting started with ctypes and am trying to use distutils to help build my module. At the moment I simply want distutils to build a shared c library (not a python extension!). Under linux, the following works, under windows xp id doesn't (which...
7
4272
by: vedrandekovic | last post by:
Hello again, Is there any patch for python "distutils", for this ImportError: cannot import name log Regards, Vedran
0
7813
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8066
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8249
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6461
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5305
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3743
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3755
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1350
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1066
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.