Python Forum
VS Code Intellisense not working
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VS Code Intellisense not working
#1
In py file 1 I have data model classes.
In py file 2, I have imported a class from the first py file.
When I reference an instance of an imported class from file 1 in file 2, I can't get the IDE to show the properties of the class.
I've documented my attempts to resolve this here
Can anyone shed some light on this for me please.
(Using Python 3.6.5 on Windows 2012 RC2 and VS Code 1.23.1)
All I get as options are:
...
end
file
flush
sep
value
Reply
#2
Most difficult without seeing actual code
Reply
#3
The link had most of the code.... :-(

setup.py:
from distutils.core import setup
setup(
name='TidalConversion',
version='0.1dev',
packages=['tidalconversion',],
license='Creative Commons Attribution-Noncommercial-Share Alike license',
long_description=open('README.txt').read(),
)

__init__.py:
#!/usr/bin/env python
import os
from tidal import *
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
engine = create_engine(os.environ['DATABASE_URL'], echo=False) #echo='debug'
Session = sessionmaker(bind=engine)

main code
from tidalconversion import Session, engine, Jobmst
jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first()

If I try and do something like
print(jobrow. and press ctrl+space I don't get any of the columns - like jobmst_id for example.
I can confirm that if I printed the type of jobrow - it would be of type tidal.Jobmst
[Image: Screen%2BShot%2B2018-05-11%2Bat%2B18.02.37.png]

The classes in the tidal.py file are just code generated by SQLACODEGEN, representing database tables and the relationships between for use with SQLAlchemy
Reply
#4
I recorded a video of the issue here

I posted on Stack Overflow here
Reply
#5
I found PEP0526 resolved this. Thanks to Ilja Everilä on Stack Overflow.
So I ended up with code like so:
jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first() # type: Jobmst
Have asked guys at SQLAlchemy if they can integrate these code hint comments into their library rather than have it at the 'client' code level.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  New to Python - Not sure why this code isn't working - Any help appreciated TheGreatNinx 4 954 Jul-22-2023, 10:21 PM
Last Post: Pedroski55
  code not working when executed from flask app ThomasDC 1 876 Jul-18-2023, 07:16 AM
Last Post: ThomasDC
  I am new to python and Could someone please explain how this below code is working? kartheekdas 2 1,002 Dec-19-2022, 05:24 PM
Last Post: kartheekdas
Exclamation My code is not working as I expected and I don't know why! Marinho 4 1,071 Oct-13-2022, 08:09 PM
Last Post: deanhystad
  Visual Studio Code Intellisense for Imported Modules Not Working hockinsk 1 2,709 Apr-23-2022, 04:41 PM
Last Post: deanhystad
  My Code isn't working... End3r 4 1,921 Mar-21-2022, 10:12 AM
Last Post: End3r
  I don't undestand why my code isn't working. RuyCab 2 1,979 Jun-17-2021, 03:06 PM
Last Post: RuyCab
  code is not working , can anybody help? RandomPerson69 4 2,898 Mar-22-2021, 04:24 PM
Last Post: deanhystad
  Short code for EventGhost not working Patricia 8 3,665 Feb-09-2021, 07:49 PM
Last Post: Patricia
  Code no longer working yk303 14 10,095 Dec-21-2020, 10:58 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

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