Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import 'rti.connextdds' due to 'invalid syntax (rti.connextdds, line 18332)' (syntax-error) #9585

Open
jzenoz opened this issue Apr 30, 2024 · 2 comments
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling

Comments

@jzenoz
Copy link

jzenoz commented Apr 30, 2024

Bug description

Hi, tested using python3.10 and python3.11 with pylint version >=3.0.0a7 throws an error when trying to import 'rti.connextdds':

$ python3.11 -m pylint --disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,too-few-public-methods --verbose *
No config file found, using default configuration
************* Module hello_publisher
hello_publisher.py:2:0: E0001: Cannot import 'rti.connextdds' due to 'invalid syntax (rti.connextdds, line 18332)' (syntax-error)
hello_publisher.py:2:0: E0611: No name 'connextdds' in module 'rti' (no-name-in-module)
************* Module hello_subscriber
hello_subscriber.py:1:0: E0001: Cannot import 'rti.connextdds' due to 'invalid syntax (rti.connextdds, line 18332)' (syntax-error)
hello_subscriber.py:1:0: E0611: No name 'connextdds' in module 'rti' (no-name-in-module)

---------------------------------------------------------------------------------------------------
Your code has been rated at 0.91/10 (previous run: 0.45/10, +0.45)
Checked 3 files, skipped 3 files
$ python3.11 -m pip freeze | grep rti
rti.connext==7.3.0

Using their hello world setup described here: https://community.rti.com/static/documentation/connext-dds/7.3.0/doc/api/connext_dds/api_python/hello.html

$ cat hello.py 
import rti.types as idl

@idl.struct
class HelloWorld:
    message: str = ""
$ cat hello_publisher.py 
import time
import rti.connextdds as dds
from hello import HelloWorld

participant = dds.DomainParticipant(domain_id=0)
topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
writer = dds.DataWriter(participant.implicit_publisher, topic)

for i in range(10):
    writer.write(HelloWorld(message=f'Hello World! #{i}'))
    time.sleep(1)
$ cat hello_subscriber.py 
import rti.connextdds as dds
import rti.asyncio
from hello import HelloWorld

participant = dds.DomainParticipant(domain_id=0)
topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
reader = dds.DataReader(participant.implicit_subscriber, topic)

async def print_data():
    async for data in reader.take_data_async():
        print(f"Received: {data}")

rti.asyncio.run(print_data())
$ python3.11 -m pip install pylint==2.17.7
...
Successfully installed pylint-2.17.7
$ python3.11 -m pylint --disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,too-few-public-methods --verbose *
No config file found, using default configuration
************* Module hello_publisher
hello_publisher.py:5:14: I1101: Module 'rti.connextdds' has no 'DomainParticipant' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_publisher.py:6:8: I1101: Module 'rti.connextdds' has no 'Topic' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_publisher.py:7:9: I1101: Module 'rti.connextdds' has no 'DataWriter' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
************* Module hello_subscriber
hello_subscriber.py:5:14: I1101: Module 'rti.connextdds' has no 'DomainParticipant' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_subscriber.py:6:8: I1101: Module 'rti.connextdds' has no 'Topic' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_subscriber.py:7:9: I1101: Module 'rti.connextdds' has no 'DataReader' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Configuration

No response

Command used

python3.11 -m pylint --disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,too-few-public-methods --verbose *

Pylint output

No config file found, using default configuration
************* Module hello_publisher
hello_publisher.py:2:0: E0001: Cannot import 'rti.connextdds' due to 'invalid syntax (rti.connextdds, line 18332)' (syntax-error)
hello_publisher.py:2:0: E0611: No name 'connextdds' in module 'rti' (no-name-in-module)
************* Module hello_subscriber
hello_subscriber.py:1:0: E0001: Cannot import 'rti.connextdds' due to 'invalid syntax (rti.connextdds, line 18332)' (syntax-error)
hello_subscriber.py:1:0: E0611: No name 'connextdds' in module 'rti' (no-name-in-module)

---------------------------------------------------------------------------------------------------
Your code has been rated at 0.91/10 (previous run: 0.45/10, +0.45)
Checked 3 files, skipped 3 files

Expected behavior

No config file found, using default configuration
************* Module hello_publisher
hello_publisher.py:5:14: I1101: Module 'rti.connextdds' has no 'DomainParticipant' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_publisher.py:6:8: I1101: Module 'rti.connextdds' has no 'Topic' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_publisher.py:7:9: I1101: Module 'rti.connextdds' has no 'DataWriter' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
************* Module hello_subscriber
hello_subscriber.py:5:14: I1101: Module 'rti.connextdds' has no 'DomainParticipant' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_subscriber.py:6:8: I1101: Module 'rti.connextdds' has no 'Topic' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
hello_subscriber.py:7:9: I1101: Module 'rti.connextdds' has no 'DataReader' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)

Pylint version

pylint 3.1.0
astroid 3.1.0
Python 3.11.0rc1 (main, Aug 12 2022, 10:02:14) [GCC 11.2.0]

pylint==3.0.0a6 works fine, as does pylint==2.17.7 and presumably versions before

OS / Environment

$ uname -a
Linux WA-ZB-5060 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Additional dependencies

rti.connext==7.3.0
@jzenoz jzenoz added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Apr 30, 2024
@UlrichEckhardt
Copy link
Contributor

Note up front: I'm not a maintainer of pylint, so take the following with a grain of salt.

Some observations:

  • Python 3.11.0rc1 is a release candidate ("rc"), not something you should use for production. I'd suggest retrying with an actual release (current is 3.11.9) instead.
  • Current Python version in Ubuntu 22.04 is 3.10.12, as far as I can tell. I tried to reproduce your setup with Docker though, so there may be some differences. How did you install those Python versions?
  • You mention pytest 3, but that's five(!) major versions behind. Not sure about their release naming, but 3.0.0a7 also seems like a prerelease version. Did you mean pylint there?
  • Your commandline uses * as an argument, which is replaced by the shell with every filename in the current working directory. That's surely not intended, though it might work by chance. It also makes it non-reproducible without knowing your whole directory content.
  • You say you installed pylint 2.17.7, but lateron say that 3.1.0 is installed. This makes it difficult to understand what you actually did and what happened.

I tried the following in an empty dir on a Ubuntu 22.04 system:

python3 -m venv pyenv
source pyenv/bin/activate.fish
python -m pip install pylint==2.17.7 # or 3.1.0, or 3.0.0, doesn't matter
python -m pip install rti.connext==7.3.0
# create a hello.py as per your instructions above
python -m pylint --disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,too-few-public-methods --verbose hello.py

With that, I couldn't reproduce what you wrote above. Can you provide step-by-step instructions?

@jzenoz
Copy link
Author

jzenoz commented May 2, 2024

Note up front: I'm not a maintainer of pylint, so take the following with a grain of salt.

Some observations:

  • Python 3.11.0rc1 is a release candidate ("rc"), not something you should use for production. I'd suggest retrying with an actual release (current is 3.11.9) instead.
  • Current Python version in Ubuntu 22.04 is 3.10.12, as far as I can tell. I tried to reproduce your setup with Docker though, so there may be some differences. How did you install those Python versions?
  • You mention pytest 3, but that's five(!) major versions behind. Not sure about their release naming, but 3.0.0a7 also seems like a prerelease version. Did you mean pylint there?
  • Your commandline uses * as an argument, which is replaced by the shell with every filename in the current working directory. That's surely not intended, though it might work by chance. It also makes it non-reproducible without knowing your whole directory content.
  • You say you installed pylint 2.17.7, but lateron say that 3.1.0 is installed. This makes it difficult to understand what you actually did and what happened.

I tried the following in an empty dir on a Ubuntu 22.04 system:

python3 -m venv pyenv
source pyenv/bin/activate.fish
python -m pip install pylint==2.17.7 # or 3.1.0, or 3.0.0, doesn't matter
python -m pip install rti.connext==7.3.0
# create a hello.py as per your instructions above
python -m pylint --disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,too-few-public-methods --verbose hello.py

With that, I couldn't reproduce what you wrote above. Can you provide step-by-step instructions?
@UlrichEckhardt

Fresh reproducer on Windows 11:

wsl --install -d Ubuntu
wsl
# Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)
apt update
apt install python3-pip
# pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
pip install pylint
pylint --version
# pylint 3.1.0
# astroid 3.1.0
# Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
pip install rti.connext
# rti.connext-7.3.0

mkdir test
cd test

echo 'import rti.types as idl

@idl.struct
class HelloWorld:
    message: str = ""' > hello.py

echo "import time
import rti.connextdds as dds
from hello import HelloWorld

participant = dds.DomainParticipant(domain_id=0)
topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
writer = dds.DataWriter(participant.implicit_publisher, topic)

for i in range(10):
    writer.write(HelloWorld(message=f'Hello World! #{i}'))
    time.sleep(1)" > hello_publisher.py

echo 'import rti.connextdds as dds
import rti.asyncio
from hello import HelloWorld

participant = dds.DomainParticipant(domain_id=0)
topic = dds.Topic(participant, "HelloWorld Topic", HelloWorld)
reader = dds.DataReader(participant.implicit_subscriber, topic)

async def print_data():
    async for data in reader.take_data_async():
        print(f"Received: {data}")

rti.asyncio.run(print_data())' > hello_subscriber.py

python3 -m pylint --disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,too-few-public-methods --verbose hello.py hello_publisher.py hello_subscriber.py
No config file found, using default configuration
************* Module hello_publisher
hello_publisher.py:2:0: E0001: Cannot import 'rti.connextdds' due to 'invalid syntax (rti.connextdds, line 18332)' (syntax-error)
hello_publisher.py:2:0: E0611: No name 'connextdds' in module 'rti' (no-name-in-module)
************* Module hello_subscriber
hello_subscriber.py:1:0: E0001: Cannot import 'rti.connextdds' due to 'invalid syntax (rti.connextdds, line 18332)' (syntax-error)
hello_subscriber.py:1:0: E0611: No name 'connextdds' in module 'rti' (no-name-in-module)

--------------------------------------------------------------------
Your code has been rated at 0.91/10
Checked 3 files, skipped 3 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling
Projects
None yet
Development

No branches or pull requests

2 participants