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

Can't access certain members errors #5828

Open
jmailloux opened this issue Apr 30, 2024 · 4 comments
Open

Can't access certain members errors #5828

jmailloux opened this issue Apr 30, 2024 · 4 comments
Assignees
Labels
needs repro Issue has not been reproduced yet waiting for user response Requires more information from user

Comments

@jmailloux
Copy link

Environment data

  • Language Server version: 2024.4.1
  • OS and version: MacOS 14.4.1 (23E224)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.2 (virtual environment)

Code Snippet

Screenshot 2024-04-29 at 11 05 28 PM

Repro Steps

Access things like Qt.DisplayRole or Qt.EditRole. Code works fine, but pylance can't find the members.

Logs

pylance_issues.log

requirements.txt

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Apr 30, 2024
@debonte
Copy link
Contributor

debonte commented Apr 30, 2024

I tried to reproduce this from your screenshot + requirements.txt, but was unsuccessful. Please provide a complete, minimal code sample (as text!) that reproduces the behavior you are seeing. The screenshot you provided above is missing imports, etc.

@debonte debonte added the waiting for user response Requires more information from user label Apr 30, 2024
@github-actions github-actions bot added user responded Was "waiting for user response" and they responded and removed waiting for user response Requires more information from user labels Apr 30, 2024
@jmailloux
Copy link
Author

Here's one where it can't find database in cantools.
can_send.txt

@jmailloux
Copy link
Author

Here is the log for that.
language_server.txt

@heejaechang
Copy link
Contributor

where can one finds DbcMessage? could you provide full code including import statements and what packages needed to be installed?

that said, for your can_send.txt, some function returned Union so code requires some kind of cast/narrow/typeguard to specify which type code assumes.

import can
import time
import cantools
import cantools.database
from cantools.database.can.database import Database
from cantools.database.can.message import Message

bus = None

def send_message(msg: Message):
    signal_values = {}
    signal_db = {}
    for signal in msg.signals:
        signal_values[signal.name] = signal.minimum
        signal_db[signal.name] = {'minimum':signal.minimum, 'maximum':signal.maximum}

    while True:
        data = msg.encode(signal_values)
        message = can.Message(arbitration_id=msg.frame_id, data=data, is_extended_id=True)
        
        assert(bus is not None)
        bus.send(message)

        for key in signal_values:
            signal_values[key] += 1
            if signal_values[key] > signal_db[key]['maximum']:
                signal_values[key] = signal_db[key]['minimum']

        time.sleep(1)  # Send a message every second

if __name__ == '__main__':
    bus = can.Bus(interface='udp_multicast', channel='239.0.0.1', port=10000, receive_own_messages=False)
    db = cantools.database.load_file('../envgo/dbc/xerotech_battery_j1939.dbc')

    assert(isinstance(db, Database))

    for msg in db.messages:
        if 'VCU' not in msg.senders:
            send_message(msg)
            break

@debonte debonte added waiting for user response Requires more information from user and removed user responded Was "waiting for user response" and they responded labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet waiting for user response Requires more information from user
Projects
None yet
Development

No branches or pull requests

3 participants