python - What does "Inspection 'Unresolved reference' actually mean? -
python - What does "Inspection 'Unresolved reference' actually mean? -
pycharm. here's code:
# db_create.py # # create database , tables # import sqlite3 config import database_path sqlite3.connect(database_path) connection: cursor = connection.cursor() # create table cursor.execute(""" create table ftasks( task_id integer primary key autoincrement, name text not null, due_date text not null, priority integer not null, status integer not null) """) # insert dummy info table cursor.execute(""" insert ftasks (name, due_date, priority, status) values("finish tutorial", "02/03/2014", 10, 1) """) cursor.execute(""" insert ftasks (name, due_date, priority, status) values("finish real python course of study 2", "02/03/2014", 10, 1) """) the code works fine. db created , well. however, message on ide. not sure referring to:
i got error message go away changing code how appears above:
# insert dummy info table cursor.execute(""" insert ftasks (name, due_date, priority, status) values('finish tutorial', '02/03/2014', 10, 1) """) cursor.execute(""" insert ftasks (name, due_date, priority, status) values('finish real python course of study 2', '02/03/2014', 10, 1) """) the alter utilize single quotes within sql statement.
why double-quoted version unresolved reference?
i should note both versions of code result in exactly same database file , contents.
further research based on suggestion double quotes within triple quotes cold causing problems pycharm's editor/parser.
i tried code on editor:
a = """ insert atable (column1, column2) values ("test",'test') """ b = """ blah blah atable (column1, column2) blah ("test",'test') """ and ran on python command line:
>>> = """ insert atable (column1, column2) values ("test",'test') """ >>> b = """ blah blah atable (column1, column2) blah ("test",'test') """ >>> '\ninsert atable (column1, column2)\nvalues ("test",\'test\')\n' >>> b '\nblah blah atable (column1, column2)\nblah ("test",\'test\')\n' both of above definitions produce strings same structure. not seeing issues regarding utilize of 2 types of quotes within triple-quoted string either @ python command line, on idle or in pycharm.
the ide editor has issue string sql version of string , not other:
if hover pointer on brownish highlights error message. "blah blah" version has no issues.
this tells me has sql/sqlite. right?
when using double quotes within of string bounded """, asking trouble.
python able handle double-quote in these types of situations, appears editor doesn't - editor uses simpler parser python interpreter, , chokes on string in format """ x"x """.
"unresolved reference" in context means pycharm thinks word finish reference variable, since incorrectly believes double-quote ended string. of course of study not have reference variable named finish.
python sqlite3 pycharm
Comments
Post a Comment