question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intellisense for a module fails in the conditional block when same module used in the if-statement (works for if-not)

See original GitHub issue

From @bgse on July 17, 2017 12:6

Environment data

VS Code version: 1.14.1 (issue also present in 1.13.x) Python Extension version: 0.6.7 Python Version: 2.7.12 OS and version: Ubuntu 16.04

Actual behavior

Intellisense for a specific module (and only this module) fails in the conditional block after the module is used in if-statement, does work for example after module is used in if-not-statement.

Expected behavior

The intellisense for the specific module should not break down depending on how it is used in a conditional statement.

Steps to reproduce:

Try the following example code, see intellisense is broken for the ‘fails’ cases, and is working for the ‘works’ cases.

import os
import sys

if not os.path.isfile('test.txt'):
    works = os.path.isfile('test.txt')
if os.path.isfile('test.txt'):
    fails = os.path.isfile('test.txt')
    works = sys.version_info
    fails = os.path.isfile('test.txt')

if sys.version_info is not None:
    works = sys.version_info

if os.path.isfile('test.txt') is True:
    fails = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is not False:
    fails = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is not True:
    works = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is False:
    works = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is not None:
    works = os.path.isfile('test.txt')

if os.path.isfile('test.txt') is None:
    fails = os.path.isfile('test.txt')

while os.path.isfile('test.txt'):
    works = os.path.isfile('test.txt')

while os.path.isfile('test.txt') is True:
    works = os.path.isfile('test.txt')

while os.path.isfile('test.txt') is not True:
    works = os.path.isfile('test.txt')

Copied from original issue: DonJayamanne/pythonVSCode#1090

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
MikhailArkhipovcommented, Apr 9, 2018

This works in VS engine

0reactions
brettcannoncommented, Apr 19, 2018

Fixed thanks to the Jedi 0.12.0 upgrade.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using If...Then...Else statements (VBA) - Microsoft Learn
Use an If...Then...Else statement to define two blocks of executable statements: one block runs if the condition is True, and the other block ......
Read more >
VBA IF (IF Then Else Statement) - Excel Champs
In the above statement, we have written an IF statement to evaluate if cell A1 has a value of 10 then it will...
Read more >
Working with Rules - ESLint - Pluggable JavaScript Linter
When linting text, it returns the value passed to —stdin-filename or <text> if not specified. getScope() - returns the scope of the currently-traversed...
Read more >
VBA If, ElseIf, Else (Ultimate Guide to If Statements)
VBA Public Variable – Use a Variable in Multiple Modules or Subs ... Here is the syntax for a simple one-line If statement:....
Read more >
Terraform tips & tricks: loops, if-statements, and gotchas
You can find working sample code for the examples in this blog post in the ... As of Terraform 0.13, the count parameter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found