Python Forum
Unresolved reference problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unresolved reference problem
#1
In the function

def parse_message(msg_data):
    ival = 0
    fval = 0.0
    opcode = msg_data[3]
    
    if opcode == MSG_OPCODE_VALUE:
        ival = (msg_data[8] << 24) | (msg_data[7] << 16) | (msg_data[6]<< 8) | msg_data[5])
        fval = ival / 10000.0

    return fval
I get - Unresolved reference 'msg_data'. Do I miss something?

Sorry. The last bracket is excessive. It generated the error.
Reply
#2
I get a syntax error from the extra parenthesis in
ival = (msg_data[8] << 24) | (msg_data[7] << 16) | (msg_data[6]<< 8) | msg_data[5])
If I remove that, the code appears to work fine.

I cannot find a way to make this code generate an Unresolved Reference error.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,572 Sep-07-2020, 08:02 AM
Last Post: perfringo
  Problem with List Reference CH_NoLuck 1 1,699 Feb-22-2020, 03:27 AM
Last Post: CH_NoLuck
  Sympy Import error: "unresolved referrence 'sympy' " BoaCoder3 0 2,695 Jul-27-2018, 12:48 PM
Last Post: BoaCoder3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020