python Examples / Getting Started Broken!

4 posts / 0 new
Last post
Offline
Last seen: 5 days 59 min ago
Joined: 02/11/2021
Posts: 2
python Examples / Getting Started Broken!

Hi,

I am currently evaluating Connext DDS 6.0.1, especially also the Python version.

It seems that the usage of Python with IDL (converted to XML) is currently broken?!

If you follow the steps mentioned here https://github.com/rticommunity/rticonnextdds-getting-started/tree/master/2_hello_world/python you will get an error.

First I use  rtiddsgen -convertToXml ../hello_world.idl

And then  python3 HelloWorldPublisher.py which fails with:

 

DDS_XMLStruct_initialize:!init XML struct object
DDS_XMLStruct_newI:!init XML struct object
RTIXMLParser_onStartTag:Parse error at line 3: Error processing tag 'struct'
RTIXMLParser_parseFromFile_ex:Parse error in file '/path/to/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml'
DDS_XMLParser_parse_from_file:Error parsing file
DDS_QosProvider_load_profiles_from_urlI:ERROR: loading profiles file '/path/to/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml'
DDS_QosProvider_load_profiles_from_url_groupI:ERROR: loading profiles
DDS_QosProvider_load_profiles_from_url_sequenceI:ERROR: loading profiles
DDS_QosProvider_load_profiles_from_policyI:ERROR: loading profiles
DDS_QosProvider_load_profilesI:ERROR: loading profiles
Traceback (most recent call last):
File "HelloWorldPublisher.py", line 83, in <module>
run_example(args.domain_id, args.sample_count)
File "HelloWorldPublisher.py", line 30, in run_example
provider = dds.QosProvider(FILE)
rti.connextdds.Error:
DDS_XMLStruct_initialize:!init XML struct object
DDS_XMLStruct_newI:!init XML struct object
RTIXMLParser_onStartTag:Parse error at line 3: Error processing tag 'struct'
RTIXMLParser_parseFromFile_ex:Parse error in file '/path/to/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml'
DDS_XMLParser_parse_from_file:Error parsing file
DDS_QosProvider_load_profiles_from_urlI:ERROR: loading profiles file '/path/to/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml'
DDS_QosProvider_load_profiles_from_url_groupI:ERROR: loading profiles
DDS_QosProvider_load_profiles_from_url_sequenceI:ERROR: loading profiles
DDS_QosProvider_load_profiles_from_policyI:ERROR: loading profiles
DDS_QosProvider_load_profilesI:ERROR: loading profiles
reload profiles

It seems the HelloWorld IDL is missing the module definition, at least the corresponding XSD file says so. 


Easy... You say?! Nope... Let me show you:

The modified IDL:

module MyData 
{

// Hello world!
struct HelloWorld {
// String with maximum length of 256 characters
string<256> msg;
};

};

Creates this XML

<?xml version="1.0" encoding="UTF-8"?>
<types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:////home/rti-connext-dds/6.0.1">
<module name="MyData">
  <struct name= "HelloWorld">
    <member name="msg" stringMaxLength="256" type="string"/>
  </struct>
</module>
</types>

 Buuuut then, Python agail fails with a misleading error:

 

Traceback (most recent call last):
File "HelloWorldPublisher.py", line 83, in <module>
run_example(args.domain_id, args.sample_count)
File "HelloWorldPublisher.py", line 32, in run_example
provider_type = provider.type("HelloWorld")
rti.connextdds.Error: no <type_library> or <types> in file

How am I supposed to use an IDL file with a module definition in Python?

Thanks

Stefan

 

 

 

 

Offline
Last seen: 19 hours 43 min ago
Joined: 04/02/2013
Posts: 161

Hi Stefan,

Please add <dds> before <types> and </dds> after </types>. So it looks like this:

<dds>

  <types>

     <module...>

     ...

     </module>

   </types>

</dds>

 

This is fixed in the code generator in the next release.

Alex

Offline
Last seen: 5 days 59 min ago
Joined: 02/11/2021
Posts: 2

Ok, when is the next release approximately scheduled?

Offline
Last seen: 19 hours 43 min ago
Joined: 04/02/2013
Posts: 161

RTI Connext 6.1.0 is expected this spring.