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
Comments
Note up front: I'm not a maintainer of pylint, so take the following with a grain of salt. Some observations:
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? |
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 |
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':
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
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
Expected behavior
Pylint version
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
Additional dependencies
The text was updated successfully, but these errors were encountered: