[Smtk-developers] Help
Yumin Yuan
yumin.yuan at kitware.com
Wed Jun 24 16:26:17 EDT 2015
Hi Indu,
Are you using the latest smtk (https://github.com/Kitware/SMTK.git), or
some older build from CMB ? The module name should be called
"smtkCorePython" now with lower case "smtk". We changed the class name of
'smtk::attribute::Manager' to 'smtk::attribute::System' a while back, so
older version of smtk will not have 'System' class.
Yumin
On Wed, Jun 24, 2015 at 3:27 PM, Shukla, Indu ERDC-RDE-ITL-MS <
Indu.Shukla at erdc.dren.mil> wrote:
> David,
>
> I simplified the script even further. But still get this error.
>
> Error:
> Traceback (most recent call last):
> File "<string>", line 5, in <module>
> File
> "/Users/indushukla/Documents/workspace/ADH_Test_Today/source/Root/Test/MetXL.py",
> line 8, in <module>
> asys = smtk.attribute.System()
> AttributeError: type object 'SMTKCorePython.smtk.attribute' has no
> attribute 'System'
>
> Thanks!
>
> Indu
>
>
> -----Original Message-----
> From: David Thompson [mailto:david.thompson at kitware.com]
> Sent: Wednesday, June 24, 2015 2:03 PM
> To: Shukla, Indu ERDC-RDE-ITL-MS
> Cc: smtk-developers at smtk.org; Hines, Amanda M ERDC-RDE-ITL-MS
> Subject: Re: [Smtk-developers] Help
>
> Hi Inda,
>
> It looks like you call "import smtk" twice. This is not an error, however,
> the variables asys and mmgr are populated at lines 25 and 26 only if the
> second import attempt fails. Since it is not failing, there are probably
> statements below that try to call methods on undefined variables.
>
> David
>
> > On Jun 24, 2015, at 2:58 PM, Shukla, Indu ERDC-RDE-ITL-MS <
> Indu.Shukla at erdc.dren.mil> wrote:
> >
> > Sorry, I took the screen shot but forgot to send you.
> >
> > -----Original Message-----
> > From: David Thompson [mailto:david.thompson at kitware.com]
> > Sent: Wednesday, June 24, 2015 1:55 PM
> > To: Shukla, Indu ERDC-RDE-ITL-MS
> > Cc: smtk-developers at smtk.org; Hines, Amanda M ERDC-RDE-ITL-MS
> > Subject: Re: [Smtk-developers] Help
> >
> > Hi Indu,
> >
> > It would help to see the script you are running instead of trying to
> guess what is happening from an error message.
> >
> > David
> >
> >> On Jun 24, 2015, at 2:53 PM, Shukla, Indu ERDC-RDE-ITL-MS <
> Indu.Shukla at erdc.dren.mil> wrote:
> >>
> >> David,
> >>
> >> Yes, I did had smtk.attribute.Item(). But the compiler still doesn't
> understands that code. It says "Undefined variable from import:System"
> >>
> >> Thanks,
> >>
> >> Indu
> >>
> >> -----Original Message-----
> >> From: David Thompson [mailto:david.thompson at kitware.com]
> >> Sent: Wednesday, June 24, 2015 1:34 PM
> >> To: Shukla, Indu ERDC-RDE-ITL-MS
> >> Cc: smtk-developers at smtk.org; Hines, Amanda M ERDC-RDE-ITL-MS
> >> Subject: Re: [Smtk-developers] Help
> >>
> >> Hi Indu,
> >>
> >> The error does not look like a library issue. Library issues would show
> up when you run "import smtk". The only way it could be a library issue is
> if you have multiple versions of the same SMTK libraries and are loading in
> mismatched versions.
> >>
> >> Are you certain that line is the one causing the problem? If I run
> >>
> >> import smtk
> >> smtk.attribute.Item()
> >>
> >> I get the error you are reporting (because indeed Item is an abstract
> class). Does "smtk.attribute.Item()" appear anywhere in your script?
> >>
> >> David
> >>
> >>> On Jun 24, 2015, at 2:28 PM, Shukla, Indu ERDC-RDE-ITL-MS <
> Indu.Shukla at erdc.dren.mil> wrote:
> >>>
> >>> David,
> >>>
> >>> Thank you so much for your prompt reply.
> >>>
> >>> I have tried using this line of code "asys = smtk.attribute.System()"
> but I get this error.
> >>>
> >>> ''NotImplementedError: 'smtk::attribute::Item' represents a C++
> abstract class and cannot be instantiated". Am I missing some library?
> >>>
> >>> Indu
> >>>
> >>> -----Original Message-----
> >>> From: David Thompson [mailto:david.thompson at kitware.com]
> >>> Sent: Wednesday, June 24, 2015 11:11 AM
> >>> To: Shukla, Indu ERDC-RDE-ITL-MS
> >>> Cc: smtk-developers at smtk.org; Hines, Amanda M ERDC-RDE-ITL-MS
> >>> Subject: Re: [Smtk-developers] Help
> >>>
> >>> Hi Indu,
> >>>
> >>>> I am Indu Shukla from ERDC, ITL. I have developed a .sbt file with a
> list of instance view and attribute view. We are not using our sbt files to
> run any kind of simulation. We only want to use this simulation template
> just as a form. Upon submission our python script is expected to read the
> values from the text boxes/radio buttons/drop downs/checkboxes from the
> simulation template and write them into Json format.
> >>>>
> >>>> Since I don't have access to SMTK API documentation I am running into
> issue how to access the those instance views/attribute views and their
> values. I am attaching me .sbt file here, please explain me through some
> examples how to access those controls and their values.
> >>>
> >>> There is a user's guide (with links to reference API documentation) at:
> >>>
> >>> http://smtk.readthedocs.org/en/latest/
> >>>
> >>> and in particular, some information about using python:
> >>>
> >>>
> >>> http://smtk.readthedocs.org/en/latest/tutorials/python_first_steps/ind
> >>> ex.html
> >>>
> >>> In terms of reading an attribute from an SBT file, this test is an
> example of how to do so from a Python script, starting at line 55:
> >>>
> >>> https://github.com/Kitware/SMTK/blob/master/smtk/attribute/testing/pyt
> >>> hon/definitionDefaultValueTest.py#L55
> >>>
> >>> and these Python tests are examples of how to access items in the
> attribute:
> >>>
> >>>
> >>> https://github.com/Kitware/SMTK/blob/master/smtk/attribute/testing/pyt
> >>> hon/attributeFindItemTest.py
> >>> https://github.com/Kitware/SMTK/blob/master/smtk/attribute/testing/pyt
> >>> hon/attributeItemByPath.py
> >>>
> >>> Hope this helps,
> >>> David
> >>
> >
> > <Attribute_error.png>
>
>
> _______________________________________________
> Smtk-developers mailing list
> Smtk-developers at smtk.org
> http://public.kitware.com/mailman/listinfo/smtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/smtk-developers/attachments/20150624/22b4e8e9/attachment.html>
More information about the Smtk-developers
mailing list