Command prompt user package

Fedra853
Fedra853 Altair Community Member
edited October 2020 in Community Q&A

Hi,

I need to use an external python package (openpyxl) to connect FLUX with a data sheet. I installed that package in the FLUX's 'lib' folder but when i try to import it in the command prompt zone, an error showing 'no module named openpyxl found' appears.

How can i install external python package in the correct way?

Grazie!

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2017

    use python import

    e.g. import sys

    sys.version

    works for python 2.7 packages, for external don't works for example:

    Can not execute the following command :
    import scipy

    Problem to import the module : scipy
    Enter sys.path to see if this module is accessible from your jython session

     

     

  • lombard
    lombard
    Altair Employee
    edited October 2017

    If you want to create or to modify excel file, you can have a look at the macro called BHSplineToExcel (located in C:\Altair\Extensions\Macros\BHSplinetoexcel.PFM for standard installation)

    For example, the jxl library is already available.

    from jxl import *
    from jxl.write import *
    import os
    from java.io import *

     

    name    = 'name_of_file'

    workbook = Workbook.createWorkbook(File(os.getcwd()+'/'+name+'.xls'))
    sheet = workbook.createSheet('BH', 0)

     

    label1 = Label(0, 0, 'Material')
    label2 = Label(1, 0, mat.name)

    sheet.addCell(label1)
    sheet.addCell(label2)

    workbook.write()
    workbook.close()
     

    If you want to add a library to Flux, you have to specify the path in the options by following the next steps:

     - Open Flux supervisor

     - Click on [Options] (on bottom left)

     - in [access path] click on [Python]

     - and then fill in the fields for the working directory of classes or libraries

    I hope it will help