importing float & raw_input()?
So... got PyCharm 3.4.1 installed on Linux Mint 17, with Python 2.7.6 & 3.4.0 installed by default.
Both versions of Python are set up in PyCharm as separate interpreters, plus another 'version' of 3.4.0 in a virtualenv.
Working my way thru an intro class (Python for Informatics). PyCharm is definitely overkill for this course, but figured I have it... its installed... might as well use it.
Running into some oddness where I setup a project via the route of opening an existing directory, selected the project interpreter as python 2.7.6, but PyCharm is throwing up errors in the margin and claiming that code like:
hrs = float(raw_input("Enter Hours: "))
has 'unresolved references' and asks to import from distlib.compat.raw_input or pip.backward_compatible.raw_input. Similarly, PyCharm is calling the same error on float() in the above line... saying it can't tell whether to use builtins.float() or __builtin__.float().
Now... the code executes correctly (as it should), but its driving me nuts seeing all the error warnings and markers that shouldn't be there. I know the default answer is that I'm using some version of python3 as the interpreter by mistake... but unless python3 is suddenly hiding under the name of '/usr/bin/python2.7' (which it isn't, the correct python is called when executed from the command line). I'm kind of at a loss on this one.
Also... for this kind of 'classroom' problem I usually cut-n-paste the question text in the beginning of the program and make it a comment, so when I look at it later I know what I was
to do vs. what I was
to do ;) Unfortunately, thats now throwing more big red warning marks:
Write a program to prompt the user for hours and rate per hour using raw_input to
is underlined in red from the beginning of 'hour' on, including every following line of the comment. Nothing shows when I hover the pointer over the lines, but when I hover over the bars in the margin it says 'Colon expected'. Huh?
A little further info... even after I take the PyCharm-suggested option to add an import statement for float(), whether in the form of
from builtins import float
from __builtin__ import float
it throws warnings for float even in those lines, and for builtins / __builtin__, even when I removed both the previous 3.4 virtualenv and python 3.4 as project interpreters. The only project interpreter pycharm
be using is python 2.7.
Starting to wonder if there is something queer going on at the system level - again, this is on Linux Mint 17, which is (more or less) Ubuntu 14.04 LTS with some tweaks, if that helps any.
How to run build script automatically?
Stepping slow in debug when lots of variables
Build #178 (Dec/17/2014 3:47PM)