rtiddsgen language python "#include foo/bar" error

2 posts / 0 new
Last post
Last seen: 2 months 2 weeks ago
Joined: 05/02/2023
Posts: 4
rtiddsgen language python "#include foo/bar" error

We are moving toward replacing the Python Connector with the Python API and our IDL files are also used with C++.   In our case rtiddsgen for python creates invalid python code, for example, in this snippet there is a missing ‘)’ at the end of the line with ‘sys.path.append’   and we also get the general error “NameError: name 'sys' is not defined ”. Details are provided below, please advise.


sys.path.append(os.path.join(os.path.dirname(sys.path[0]),  /Test_001/idls/foo/')

from bar import *





rtiddsgen version 4.1.0


python --version

Python 3.6.8


python3.10 --version

Python 3.10.8



Command line for running rtiddsgen :


rtiddsgen -language Python   -verbosity 3   -update typefiles -I /home/user/Test_001/otherIdls/  /home/user/idls/helloWorld.idl


Directory structure:











#include "foo/bar.idl"

struct HelloWorld {

    string<128> msg;



Complete file generated:


from dataclasses import field

from typing import Union, Sequence, Optional

import rti.idl as idl

from enum import IntEnum


sys.path.append(os.path.join(os.path.dirname(sys.path[0]), 'Test_001/idls/foo/')

from bar import *




    member_annotations = {

        'msg': [idl.bound(128)],



class HelloWorld:

    msg: str = ""

Last seen: 2 months 3 weeks ago
Joined: 10/15/2018
Posts: 9

We are aware of the issue (CODEGENII-1847) and it will be fixed in the next release. The issue affects any IDL included with a path.

The workaround is to remove the path from the include file. If you change the rtiddsgen call to:
rtiddsgen -language Python   -verbosity 3   -update typefiles -I /home/user/Test_001/otherIdls/foo  /home/user/idls/helloWorld.idl

And the included idl to:

#include "bar.idl"

It should work