To answer my own question, I was able to solve this, setting the 
OTB_APPLICATION_PATH environment variable. I decided to set it in the 
application rather than in the user environment with:

otbpath = os.environ.get('OTB_APPLICATION_PATH', None)
if otbpath is None:
    os.environ['OTB_APPLICATION_PATH']='/usr/lib/otb/applications/'


Obviously you would need to improve on this if you needed it to work on 
Windows also.


On Monday, April 17, 2017 at 9:29:39 PM UTC-4, Stephen Woodbridge wrote:
>
> I having the same problem on Ubuntu 16.04 where I installed it via apt-get 
> install python-otb libotb monteverdi otb-bin and when it installed it did 
> not add /usr/lib/otb/python to the site python path, so I'm guessing that 
> some other initialization on install was not done. Anyone know how to fix 
> this?
>
> On Tuesday, April 4, 2017 at 6:09:28 AM UTC-4, M E C wrote:
>>
>> Hi there,
>>
>> So I am trying to use otb from Python in Windows 7 and I'm not able to do 
>> it. I guess it must be an installation error.
>> I copied the example from 
>> https://www.orfeo-toolbox.org/CookBook/OTB-Applications.html#using-the-python-interface,
>>  
>> that starts with the lines:
>>
>> from sys import argvimport otbApplicationprint "Available applications : 
>> "print str( otbApplication.Registry.GetAvailableApplications() )app = 
>> otbApplication.Registry.CreateApplication("Smoothing")print 
>> app.GetParametersKeys()
>>
>> It prints "Available applications :" but then only "()"
>>
>> And I get the following error: 
>>
>> Traceback (most recent call last):
>>   File "C:\Users\user\Desktop\Soils\Exampleotb.py", line 21, in <module>
>>     print app.GetParametersKeys()
>> AttributeError: 'NoneType' object has no attribute 'GetParametersKeys'
>>
>>
>> It must be something simple but I don't see it. Any clue, please?
>>
>> I am using OTB 10.1 and Linux 2.7.13 for win64
>>
>> Thank you!
>>
>>
>>
>>

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-users@googlegroups.com
To unsubscribe from this group, send email to
otb-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to otb-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to