Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to import Python package into Jython running under Arm Development Studio?

Hello,

I was trying to use some APIs in bitstruct package (from: https://pypi.org/project/bitstruct/) in the Jython script file running under Arm Development Studio (ADS) v2021.2 (using "source dump_reg.py" command),  the dump_reg.py is like as below:


import sys, getopt

from arm_ds.debugger_v1 import Debugger
from arm_ds.debugger_v1 import DebugException
from collections import namedtuple
from bitstruct import *
   debugger = Debugger()
   ec = debugger.getExecutionContext(0)
   ec.getExecutionService().stop()
   ec.getExecutionService().waitForStop(0)
   val = ec.getMemoryService().readMemory32(ADDRESS)
   data_reg_name = namedtuple('Data1', ['a', 'b', 'c', 'd'])
    unpacked = unpack('u1u3u4u24', val)
    data1name = RegName(*unpacked)
    print ( data_reg_name )
But got error message:
ERROR(?): ImportError: No module named bitstruct
How can I fix this?
Thanks
Parents
  • Hi again Xiaoming,

    Apologies for not getting back to you sooner.  I had mistakenly thought that "pip install" would work, but I can now see that it doesn't.

    Jython in Arm DS is v2.7.2.  Is there 2.x-compatible version of bitstruct available?  It appears to be for CPython 3 only.
    If not, then I'm afraid there isn't an easy way to import the package into Arm DS.

    The only workaround I can think of is to copy the relevant bitstruct code into your Jython project.  That seemed to work for me.

    Hope this helps

    Stephen

Reply
  • Hi again Xiaoming,

    Apologies for not getting back to you sooner.  I had mistakenly thought that "pip install" would work, but I can now see that it doesn't.

    Jython in Arm DS is v2.7.2.  Is there 2.x-compatible version of bitstruct available?  It appears to be for CPython 3 only.
    If not, then I'm afraid there isn't an easy way to import the package into Arm DS.

    The only workaround I can think of is to copy the relevant bitstruct code into your Jython project.  That seemed to work for me.

    Hope this helps

    Stephen

Children