Intellisense not working

Nov 26, 2013 at 9:25 PM
Okay, I know this has been discussed before but I'm not seeing how to get the simplest code completion and intellisense working in VS 2013. I've installed PTVS 2.0 on top of VS 2013. python 2.7 is on my machine and it seems to recognize this as the default interpreter.
But, if I start typing something as simple as:
gag = tr
it should show me True as an option so I can just hit tab to complete the statement and capitalize the T.
Also, if I type:
assert isin
it should show me isinstance as an option and it doesn't show me anything.
I do get intellisense on my python classes however. What gives?

Steve
Coordinator
Nov 26, 2013 at 9:29 PM
If you hit Ctrl+Space after tr or isin do you see a list of completions?

What's probably happening is that we don't trigger completions on every keypress (mainly for performance reasons). We will display them if you press '.', which is why you'll see member completions. You can use Ctrl+Space at any time to complete what you are currently typing, or to see what options you have.

There is also an extension that somebody else wrote that will make Python provide suggestions for every keypress. You could try that, but it has nothing to do with us, so make sure you go to their site if it does not work properly.
Nov 26, 2013 at 9:35 PM
Okay, yes I do see them after hitting Ctrl + space. At least now I know how to get that. I may try the extension you suggest.

Thank you for the very quick response too... :)

Steve
Jan 10, 2014 at 8:04 PM
Edited Jan 10, 2014 at 8:06 PM
Well shoot.
It seems I cannot get this thing to work at all Zooba. I moved away from the VM to my local dev box, install IE 11, VS 2013 and PTVS for 2013 and I can't even get intellisense on os. If I hover over:

import os
it show me os: <unknow type>

Under Environment Options, it finds python 2.7 and all so I don't know what gives here.
It also reports that the Completion DB is up to date.

Steve
Coordinator
Jan 10, 2014 at 9:17 PM
Do you get IntelliSense for sys? What about if you your own class or function?
Jan 10, 2014 at 9:21 PM
No on sys,
yes on class in project
Coordinator
Jan 10, 2014 at 9:25 PM
Can you copy/attach the contents of Tools->Python Tools->Diagnostic Info into an email to ptvshelp@microsoft.com? I'd like to take a look.
Coordinator
Jan 13, 2014 at 5:52 PM
Thanks for that. I don't see anything specific going wrong, though your logs are quite strange (missing entries, apparently). What that probably means is that something has gone wrong and we don't have logging for it.

The best suggestion I can give is to delete your C:\Users\<username>\AppData\Local\Python Tools folder and refresh your DB. At worst, we should get cleaner logs, and at best everything will "just work".

Unfortunately, I don't have access to the same Python distribution as you are using, so I can't try and reproduce your issue. If after a clean regeneration you're still seeing issues, let me know and I'll see what ideas I can come up with.
Coordinator
Jan 13, 2014 at 8:38 PM
Thanks again for the new log. I don't have a solution yet but I'm working on an idea.

The details probably won't help anyone outside of our team, but I'm looking into these lines in the global analysis log:
2014-01-13T11:40:41 START_STDLIB "...\Microsoft.PythonTools.Analyzer.exe" ...
FAIL_STDLIB: (-3) "...\Microsoft.PythonTools.Analyzer.exe" ...
This interpreter is already being analyzed.
2014-01-13T11:45:40 DONE_STDLIB "...\Microsoft.PythonTools.Analyzer.exe" ...
On initial inspection, it should be impossible for us to get both the FAIL message and the DONE message, so when I find a plausible explanation I may have some experiments to try, but until then I'm stumped (or more precisely, I have a large number of implausible/untestable ideas :) ).

PTVS seems to be working fine otherwise, so uninstalling/reinstalling is unlikely to make any difference. What may be worth checking is whether a vanilla Python install works? (I'd suggest a version other than 2.7, since that will conflict with your existing one) If we can confirm that it's something to do with the distribution you're using, then I've got a better chance of finding a repro or solution.
Jan 13, 2014 at 8:45 PM
Edited Jan 13, 2014 at 8:46 PM
Zooba,
Thanks for the reply. The python interpreter we use is installed with ESRI, ArcGIS Desktop 10.1. Since our shop depends on this install for line of business, I'm nervous to try another python install as it may mess stuff up. Although, both 2.6 and 2.7 were installed on this machine, 2.6 seems to have been at least partially removed with the removal of ArcGIS Desktop 10.0.

Will installing another version of python interfere with PATH setting etc?

I might be able to be persuaded to install another version on my VM however.
Coordinator
Jan 13, 2014 at 10:09 PM
You should be safe enough installing Python 3.3, though if you're more comfortable using a VM then I'll understand.

Are you seeing the same issue on your VM currently? (I know you mentioned it in an earlier message but I'm not quite clear which machine I've been looking at the logs for.)
Jan 14, 2014 at 5:34 PM
Okay,
So on my VM, when I hover over the
import os
line, it shows me
os: built-in module os
so it's working there. It's the VM that throws errors on opening the workbook with openpyxl

I'm not sure I'd be able to use python 3.3 in my environment, due to the ArcGIS Desktop product as noted above, so I'm not sure what would be gained by installing it.
I just wonder if there's a way to get PTVS working with version 2.7.2, the python version we have installed.

Thanks,
steve
Coordinator
Jan 14, 2014 at 6:21 PM
My main interest in Python 3.3 is whether there's an issue with PTVS generally or if it is specific to ArcGIS and the libraries it includes. I'm inclined to assume that it is something to do with ArcGIS, but since I don't have access to their product I've got no way to confirm, and in any case I don't know what they could do to break us like this. It's quite a mystery.

It's also possible that you're hitting an issue that we've already fixed. You could try installing a dev build of PTVS to see if that helps, though you will almost certainly hit other issues in that build (or maybe not, it really depends on the functionality that you use).
Coordinator
Jan 14, 2014 at 9:18 PM
I installed ArcGIS and tried it myself with PTVS 2.0 RTM on VS 2013 Ultimate, and everything seems to work fine. I've installed pip and openpyxl as well with no issue.

One thing to check: when you say you've typed import os, that is literally import os and not from os import..., right? We have a known issue where the second one will show "unknown type" in the tooltip (which is technically correct, since the name 'os' does not exist) - just want to make sure we're not suffering from incorrect expectations (wouldn't be the first time :) )

Also, I checked that installing Python 3.3.3 from www.python.org doesn't affect ArcGIS and it also seems to be fine. Since I can't reproduce the issue, could you please check whether another Python install will work on your machine?

Finally, I figured out the log message that I quoted above and it's fine. When you create or open a project we will trigger DB refresh if necessary, and if it's already running then the log ends up looking exactly like that. (It ought to include a message saying that it was automatically triggered.)
Jan 14, 2014 at 9:27 PM

Yes it was:

Import os

I have vs 2013 premium installed but that should make a difference.

Good grief. It’s working here now too and I didn’t change a thing. WTH?

I’m getting intellisense using the Ctl-space also.

I will continue my testing and try not to report any junk to you.

Thanks Steve

P.S. I would much rather settle on using VS 2013 for python development than the Wing IDE. They have me developing in so many different languages now it’s ridiculous. I’m new to python can you tell??? J

Steve

Jan 17, 2014 at 10:52 PM
Hey Zooba,
just wanted to let you know that everything seems to be working as expected. I'm not having problems with openpyxl either. I don't know if I loaded a newer rev when I uninstalled and re-installed or what but I didn't change anything else and things are working now.

Thanks for your help

Steve
Coordinator
Jan 17, 2014 at 10:58 PM
That's good to hear, though a little annoying that we couldn't figure out what was going wrong.

Be sure to come back if (when) you run into more issues :)