Hello Kay,
thank you for the answer.
With this jar (commons-math) I tested and it works.
But with my jar didn't work, and I couldn't find any log to identify the
problem . Any idea of how to debug this?
The jar i'm trying to import is this
https://bintray.com/jai-imageio/maven/download_file?file_path=com%2Fgithub%2Fjai-imageio%2Fjai-imageio-core%2F1.3.1%2Fjai-imageio-core-1.3.1.jar
Anyway, pcaspy could be a good solution too.
Regards
Em 28-11-2016 12:01, Kasemir, Kay escreveu:
Hi:
Fundamentally, what Charles-Henri suggested is correct.
For example, if you want to use the commons-math jar, you can do this:
import sys
sys.path.append(‘/full/path/to/your/copy/of/commons-math3-3.2.jar’)
from org.apache.commons.math3.fitting import CurveFitter
If your import fails, check the log file to see if there are error messages.
For example, maybe some class in the jar cannot be resolved because of further dependencies.
Note, however, that BOY will execute jython scripts on the UI thread, so all of CSS will freeze while you’re executing your script.
If you really need to do something that takes longer, you should create a Runnable inside your script and execute that on a new Thread.
Then use Display.asyncExec() for interacting with the widgets back on the UI thread.
Ideally, move what you think you have to do in a script into an IOC (which may be a pcaspy-based python IOC) and in the UI you then just read/write PVs. All the logic is in the IOC.
-Kay
On Nov 28, 2016, at 5:24 AM, Gabriel de Souza Fedel <[email protected]> wrote:
Hi Pattard,
thank you for the answer.
I tried your solution, but didn't work.
The console error is this:
"ImportError: No module named github"
I'm trying to import a module called com.github.imageio, but the
cs-studio didn't find it....
I'm tried another jars that didn't work too. I'm tried to add path inside my code too, but nothing works.
What version of CSS you are using?
Regards
Em 28-11-2016 06:29, Patard Charles-Henri escreveu:
Hi Gabr iel,
Can you show the console error ? I’ve got this kind of problem with
Jython imports. Even if you modify PYTHONPATH or CS-Studio PYTHONPATH
preferences it doesn’t work. To solve it I needed to create a python
script named ImportDependencies.py :
“
#Python imports
import sys
from os.path import expanduser
# Get Home path
HOME_PATH = expanduser("~")
print 'importDependencies HOME_PATH '+str(HOME_PATH)
# Add librairies
sys.path.append(str(HOME_PATH)+'/path/to/jar/file')”
In a second time, you have to import ImprtDependencies.py in your
Jython/Python script like this : “import ImportDependencies”.
Best regards.
------------------------------------------------------------------------
/Préservons notre environnement, n’imprimez ce mail que si nécessaire./
/Preserve our environment, print this email only if necessary./
--
Gabriel Fedel
Software de Operação das Linhas de Luz
Laboratório Nacional de Luz Síncrotron – (LNLS)
Centro Nacional de Pesquisa em Energia e Materiais (CNPEM)
[email protected] | +55 (19) 3512 1226
www.lnls.cnpem.br
--
Gabriel Fedel
Software de Operação das Linhas de Luz
Laboratório Nacional de Luz Síncrotron – (LNLS)
Centro Nacional de Pesquisa em Energia e Materiais (CNPEM)
[email protected] | +55 (19) 3512 1226
www.lnls.cnpem.br
- References:
- CSS - Problem importing Jar on Jython Patard Charles-Henri
- Re: CSS - Problem importing Jar on Jython Gabriel de Souza Fedel
- Re: CSS - Problem importing Jar on Jython Kasemir, Kay
- Navigate by Date:
- Prev:
Re: SNL sequencer apparently losing connection to underlying network Kevin Meyer
- Next:
Re: MEDEM sexagesimal number format Luca Cavalli
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: CSS - Problem importing Jar on Jython Kasemir, Kay
- Next:
New sequencer release 2.2.4 Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
|