| Hi Steven,
Thanks for the reply on this. I think you are probably right that this
is an issue one have to deal with on a case by case basis. It's good
to know that the behaviour is general, and not just something that
happens on my system.
best
Oeyvind
2016-07-04 12:28 GMT-07:00 Steven Yi :
> Hi Oeyvind,
>
> I took a brief look around online and it seemed to me that this kind
> of problem isn't unusual when embedding python to have a different
> sys.path. I don't know if there is an easy way to get the same path
> as the command-line interpreter though. Perhaps best to file an issue
> and maybe someone can take a look?
>
> steven
>
> On Thu, Jun 30, 2016 at 3:25 PM, Oeyvind Brandtsegg
> wrote:
>> Hi,
>> I'm not sure if this is an issue in general or if it just happens on
>> my system, so I'd be happy if someone else on windows would test it.
>>
>> The issue is that Python's sys.path differs when running python via
>> the py opcodes from when running it plainly on the command line.
>>
>> pyruni "print sys.path" gives:
>> ['C:\\Python27\\Lib', 'C:\\windows\\system32\\python27.zip',
>> 'C:\\Projects\\Cross adaptive PKU\\csound_dev\\fft_rhythm',
>> 'C:\\Program Files\\Csound6_x
>> 64\\bin', 'C:\\Users\\Administrator\\AppData\\Roaming\\Python\\Python27\\site-packages',
>> 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']
>>
>> python on the command line gives:
>>>>> sys.path
>> ['', 'C:\\Python27\\Lib', 'C:\\windows\\system32\\python27.zip',
>> 'C:\\Python27\\DLLs', 'C:\\Python27\\lib\\plat-win',
>> 'C:\\Python27\\lib\\lib-tk', 'C:
>> \\Python27', 'C:\\Users\\Administrator\\AppData\\Roaming\\Python\\Python27\\site-packages',
>> 'C:\\Python27\\lib\\site-packages']
>>
>> Of particular interest is the 'C:\\Python27\\DLLs', missing when
>> running python via the py opcodes.
>> This prevented me from importing numpy when running python in Csound,
>> and this was how I discovered it.
>>
>> A workaround is:
>> pyruni "sys.path.append('c:\\python27\DLLs')"
>> but it would be more elegant if it would just work like python on the
>> command line.
>>
>> Does the same happen (missing c:\\python27\DLLs') for others ?
>>
>> Oeyvind
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://flyndresang.no/
>> http://soundcloud.com/t-emp
--
Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://flyndresang.no/ |