[Csnd-dev] Python Opcodes and Library Loading
Date | 2016-09-22 20:29 |
From | Steven Yi |
Subject | [Csnd-dev] Python Opcodes and Library Loading |
Hi All, I took a look at csmodules.c and I wonder if this could be a cause of the issue: PUBLIC int csoundOpenLibrary(void **library, const char *libraryPath) { int flg = RTLD_NOW; if (libraryPath != NULL) { int len = (int) strlen(libraryPath); /* ugly hack to fix importing modules in Python opcodes */ if (len >= 9 && strcmp(&(libraryPath[len - 9]), "/libpy.so") == 0) flg |= RTLD_GLOBAL; } *library = (void*) dlopen(libraryPath, flg); return (*library != NULL ? 0 : -1); } Note the "ugly hack" comment. Also note that the it explicitly contains .so in the name. If the issue Oeyvind and Rory reported is only happening on OSX, it could be that this hack needs application to the libpy.dylib that Csound loads. Could someone on OSX give this a try? |
Date | 2016-09-22 20:31 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Python Opcodes and Library Loading |
Are they having trouble importing modules? Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 22 Sep 2016, at 20:29, Steven Yi |
Date | 2016-09-22 20:44 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd-dev] Python Opcodes and Library Loading |
The initial report came from me, but I'm not on OSX myself, so not 100% sure, but afaicr it only happens when the Python code resides in an external (py) file. The py file would then be imported like a module yes. 2016-09-22 12:31 GMT-07:00 Victor Lazzarini |
Date | 2016-09-22 20:50 |
From | Tarmo Johannes |
Subject | Re: [Csnd-dev] Python Opcodes and Library Loading |
Thanks for pointing it out, that was it! On OSX it works now. I had installed Csound before the release to check CsoundQt against it and forgot it was somewhat pre-release version. I will check later for Windows, if there is a newer installer, too that I have. Gratefully, tarmo 2016-09-22 15:31 GMT-04:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>: Are they having trouble importing modules? |
Date | 2016-09-22 21:05 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Python Opcodes and Library Loading |
Ok, so it's something we can try. I can fire off a package from develop for one of you to try tomorrow, if you wish. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 22 Sep 2016, at 20:44, Oeyvind Brandtsegg |
Date | 2016-09-22 22:19 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] Python Opcodes and Library Loading |
That would be great. Just send us on the link and I will try it here. On 22 September 2016 at 21:05, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: Ok, so it's something we can try. I can fire off a package from develop for one of you to try tomorrow, if you wish. |