On 24.02.2013 15:48, ecir hana wrote:
> On Sun, Feb 24, 2013 at 3:43 PM, M.-A. Lemburg <mal(a)egenix.com> wrote:
>
>> On 24.02.2013 15:18, ecir hana wrote:
>>
>
>> Try a dtruss of the operation to check what gcc is looking for
>> and where.
>>
>
> You mean "sudo dtruss gcc -lname python33"? Do you mind if I post the
> result here, as I don't really understand what it is doing?
You need to run "sudo dtruss -f gcc -lpython3.3", since the …
[View More]trace
you posted stops at the vfork() and doesn't include the interesting
parts.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Feb 24 2013)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
[View Less]
On 24.02.2013 15:18, ecir hana wrote:
> On Sun, Feb 24, 2013 at 3:10 PM, M.-A. Lemburg <mal(a)egenix.com> wrote:
>
> You can try to use dylibs
>> for your application, but chances are high that your users will
>> run into problems picking up a dylib from one of the many sources
>> for this file
>>
>
> I thought that if I include the dynamic library into the application bundle
> it should pick the version I provide..?
That's how it works on …
[View More]Windows, but not on a typical Unix system.
I don't know how Mac OS X works if you put the dylib into the
application bundle - AFAIK, the bundle is just a directory, i.e.
not special when it comes to linking, but I could be wrong.
>> "gcc -lname" will look for a file libname.a or libname.dylib. Please
>> see the man page for details.
>>
>
> That's exactly the problem, The folder has "libpython33.dylib" file but
> when I do "gcc -lname libpython33" it says
> "i686-apple-darwin11-llvm-gcc-4.2: libpython33: No such file or directory".
Try a dtruss of the operation to check what gcc is looking for
and where.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Feb 24 2013)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
[View Less]
On 24.02.2013 14:55, ecir hana wrote:
> On Sun, Feb 24, 2013 at 2:30 PM, M.-A. Lemburg <mal(a)egenix.com> wrote:
>
>>
>> Something is wrong here: the library is usually called something
>> like "libpython3.3m.a".
>>
>
> There was "libpython3.3.dylib" which is a symlink to "Python" which I
> renamed to "python33" so it does not collide with installed "Python" v2.7.
> I also tried "python33.dylib", "libpython33", "libpython33.dylib",
> "…
[View More]libpython33.so" to no avail...
Sorry, I can't help with the versions from the Python installer
on python.org. Both the Apple provided and the python.org versions
have given us too much trouble in the past. We're always compiling
our own versions, try to avoid fat binaries and use default settings
when compiling Python.
> Btw, why ".a"? I thought that for static linking. The binary distribution
> from python.org only contains some dylibs...
The .a libs are indeed for static linking. You can try to use dylibs
for your application, but chances are high that your users will
run into problems picking up a dylib from one of the many sources
for this file (Apple's Python lib, python.org installer, MacPorts,
Homebrew, Fink, etc.). Each of those will likely have been compiled
using slightly different settings or even come with internal changes.
You can avoid all that by doing static linking.
> Please make sure that you actually have the correct library in
>> your current directory.
>>
>
> I think I have - it just those 3 files from above in the directory.
"gcc -lname" will look for a file libname.a or libname.dylib. Please
see the man page for details.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Feb 24 2013)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
[View Less]
On 24.02.2013 13:25, ecir hana wrote:
> Hello,
>
> I would like to embed Python 3.3, I followed the simplest tutorial here:
> http://docs.python.org/3.3/extending/embedding.html
>
> I'm on MacOS 10.8 which has Python 2.7 but I would like to embed the 3.3
> version. I downloaded v3.3 binary distribution from python.org for Mac. I
> unzipped the archive, took out all the headers and "Python" dynamic library
> to a new folder. I then renamed the "Python" file to "…
[View More]python33" so that it
> wont collide with installed Python 2.7. So in the folder, there are:
>
> embed.c
> include (folder)
> python33
>
> Running "file python33" says:
>
> python33 (for architecture i386): Mach-O dynamically linked shared
> library i386
> python33 (for architecture x86_64): Mach-O 64-bit dynamically linked
> shared library x86_64
Something is wrong here: the library is usually called something
like "libpython3.3m.a".
> and embed.c is:
>
> #include <Python.h>
>
> int
> main(int argc, char *argv[])
> {
> Py_Initialize();
> PyRun_SimpleString("print 'test'\n");
> Py_Finalize();
> return 0;
> }
>
> It compiles but when I do "gcc embed.c -I./include -L. -lpython33" it
> breaks with:
>
> ld: library not found for -lpython33
This would have to be -lpython3.3m or similar.
> Please, does anyone know how to make it compile? I don't want to *install*
> Python 3.3 - is it possible to just extract the dynamic library from the
> binary distribution and use it, like I did above? I also tried:
>
> DYLD_LIBRARY_PATH="." gcc embed.c -I./include -L. -lpython33
>
> but it doesn't work.
Please make sure that you actually have the correct library in
your current directory.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Feb 24 2013)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
[View Less]
Hello,
I would like to embed Python 3.3, I followed the simplest tutorial here:
http://docs.python.org/3.3/extending/embedding.html
I'm on MacOS 10.8 which has Python 2.7 but I would like to embed the 3.3
version. I downloaded v3.3 binary distribution from python.org for Mac. I
unzipped the archive, took out all the headers and "Python" dynamic library
to a new folder. I then renamed the "Python" file to "python33" so that it
wont collide with installed Python 2.7. So in the folder, there are:…
[View More]
embed.c
include (folder)
python33
Running "file python33" says:
python33 (for architecture i386): Mach-O dynamically linked shared
library i386
python33 (for architecture x86_64): Mach-O 64-bit dynamically linked
shared library x86_64
and embed.c is:
#include <Python.h>
int
main(int argc, char *argv[])
{
Py_Initialize();
PyRun_SimpleString("print 'test'\n");
Py_Finalize();
return 0;
}
It compiles but when I do "gcc embed.c -I./include -L. -lpython33" it
breaks with:
ld: library not found for -lpython33
Please, does anyone know how to make it compile? I don't want to *install*
Python 3.3 - is it possible to just extract the dynamic library from the
binary distribution and use it, like I did above? I also tried:
DYLD_LIBRARY_PATH="." gcc embed.c -I./include -L. -lpython33
but it doesn't work.
[View Less]
Hello!
Tell me please, Is there any possibility to pause/resume the work of embedded python interpreter in place, where I need? For example:
C++ pseudo-code part:
main()
{
script ="python_script.py";
...
RunScript(script);//-- python script runs till the command 'stop'
while(true){
//... read values from some variables in python-script
//... do some work ...
//... write new value to some other variables in python-script
ResumeScript(script);…
[View More]//-- python script resumes it's work where// it was stopped. Not from begin! }
...
}
Python script pseudo-code part:
#... do some init-work
whiletrue:
#... do some work
stop # - here script stops and C++-function RunScript()
# returns control to C++-part
#... After calling C++-function ResumeScript
# the work continues from this line
Is this possible to do with Python/C API?
Thanks
[View Less]