What does this “note: see declaration of '_PyInitError'” error mean when trying to package a C module...
up vote
1
down vote
favorite
Following my previous question here, I would like to import this C/C++ implementation of sha256
into my python script (Python 3.7.0)
and run some performance tests.
From the official documentation it seems that one way of doing this is to use distutil
built-in module of python to package this as a new module and then install it so that it becomes importable to any script.
The first step I took was to download the sha256module.c
code and save it into my current directory. In the same directory, I then created a setup.py
with the following content that python's documentation recommends here.
setup.py:
from distutils.core import setup
from distutils.extension import Extension
setup(name='sha256_test1',
version='1.0',
description = 'This is a test sha256 function',
ext_modules=[Extension('sha256', sources = ['sha256module.c'])],
)
After creating the setup file, from command prompt and in the same directory as the setup I run python setup.py build
. In the first place, I received "Unable to find vcvarsall.bat" error and based on the answer to this question I installed visual studio 2017 community version on my Win10 x64 operating system. The error is gone. But I received errors indicating lack of some other files that seemed necessary for packaging. They are listed as:
hashlib.h
coreconfig.h
pystrhex.h
python.h
structmember.h
tracemalloc.h
clinic/sha256module.c.h
I added them to the current directory and when I run python setup.py build
again I get another error saying "note: see declaration of '_PyInitError" which I assumed might be from the lack of __init__.py
so I created an empty one but it didn't work.
I am not sure if I am doing this all the way right. What do you think about this procedure?! Am I on the correct direction?! If yes please tell me how to tackle the error and if no please indicate why and where I am doing wrong.
python sha256 distutils
add a comment |
up vote
1
down vote
favorite
Following my previous question here, I would like to import this C/C++ implementation of sha256
into my python script (Python 3.7.0)
and run some performance tests.
From the official documentation it seems that one way of doing this is to use distutil
built-in module of python to package this as a new module and then install it so that it becomes importable to any script.
The first step I took was to download the sha256module.c
code and save it into my current directory. In the same directory, I then created a setup.py
with the following content that python's documentation recommends here.
setup.py:
from distutils.core import setup
from distutils.extension import Extension
setup(name='sha256_test1',
version='1.0',
description = 'This is a test sha256 function',
ext_modules=[Extension('sha256', sources = ['sha256module.c'])],
)
After creating the setup file, from command prompt and in the same directory as the setup I run python setup.py build
. In the first place, I received "Unable to find vcvarsall.bat" error and based on the answer to this question I installed visual studio 2017 community version on my Win10 x64 operating system. The error is gone. But I received errors indicating lack of some other files that seemed necessary for packaging. They are listed as:
hashlib.h
coreconfig.h
pystrhex.h
python.h
structmember.h
tracemalloc.h
clinic/sha256module.c.h
I added them to the current directory and when I run python setup.py build
again I get another error saying "note: see declaration of '_PyInitError" which I assumed might be from the lack of __init__.py
so I created an empty one but it didn't work.
I am not sure if I am doing this all the way right. What do you think about this procedure?! Am I on the correct direction?! If yes please tell me how to tackle the error and if no please indicate why and where I am doing wrong.
python sha256 distutils
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Following my previous question here, I would like to import this C/C++ implementation of sha256
into my python script (Python 3.7.0)
and run some performance tests.
From the official documentation it seems that one way of doing this is to use distutil
built-in module of python to package this as a new module and then install it so that it becomes importable to any script.
The first step I took was to download the sha256module.c
code and save it into my current directory. In the same directory, I then created a setup.py
with the following content that python's documentation recommends here.
setup.py:
from distutils.core import setup
from distutils.extension import Extension
setup(name='sha256_test1',
version='1.0',
description = 'This is a test sha256 function',
ext_modules=[Extension('sha256', sources = ['sha256module.c'])],
)
After creating the setup file, from command prompt and in the same directory as the setup I run python setup.py build
. In the first place, I received "Unable to find vcvarsall.bat" error and based on the answer to this question I installed visual studio 2017 community version on my Win10 x64 operating system. The error is gone. But I received errors indicating lack of some other files that seemed necessary for packaging. They are listed as:
hashlib.h
coreconfig.h
pystrhex.h
python.h
structmember.h
tracemalloc.h
clinic/sha256module.c.h
I added them to the current directory and when I run python setup.py build
again I get another error saying "note: see declaration of '_PyInitError" which I assumed might be from the lack of __init__.py
so I created an empty one but it didn't work.
I am not sure if I am doing this all the way right. What do you think about this procedure?! Am I on the correct direction?! If yes please tell me how to tackle the error and if no please indicate why and where I am doing wrong.
python sha256 distutils
Following my previous question here, I would like to import this C/C++ implementation of sha256
into my python script (Python 3.7.0)
and run some performance tests.
From the official documentation it seems that one way of doing this is to use distutil
built-in module of python to package this as a new module and then install it so that it becomes importable to any script.
The first step I took was to download the sha256module.c
code and save it into my current directory. In the same directory, I then created a setup.py
with the following content that python's documentation recommends here.
setup.py:
from distutils.core import setup
from distutils.extension import Extension
setup(name='sha256_test1',
version='1.0',
description = 'This is a test sha256 function',
ext_modules=[Extension('sha256', sources = ['sha256module.c'])],
)
After creating the setup file, from command prompt and in the same directory as the setup I run python setup.py build
. In the first place, I received "Unable to find vcvarsall.bat" error and based on the answer to this question I installed visual studio 2017 community version on my Win10 x64 operating system. The error is gone. But I received errors indicating lack of some other files that seemed necessary for packaging. They are listed as:
hashlib.h
coreconfig.h
pystrhex.h
python.h
structmember.h
tracemalloc.h
clinic/sha256module.c.h
I added them to the current directory and when I run python setup.py build
again I get another error saying "note: see declaration of '_PyInitError" which I assumed might be from the lack of __init__.py
so I created an empty one but it didn't work.
I am not sure if I am doing this all the way right. What do you think about this procedure?! Am I on the correct direction?! If yes please tell me how to tackle the error and if no please indicate why and where I am doing wrong.
python sha256 distutils
python sha256 distutils
asked Nov 20 at 11:53
PouJa
748
748
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392432%2fwhat-does-this-note-see-declaration-of-pyiniterror-error-mean-when-trying%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392432%2fwhat-does-this-note-see-declaration-of-pyiniterror-error-mean-when-trying%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown