![]() ![]() PEP8 works now but relative imports lead to "Undefined variable" errors. PS: The scenario is exactly the same in LiClipse. But the whole point of using an IDE is having features that catch these errors beforehand, so if anybody has some light to shed on this issue it would certainly be very appreciated. There are no error or warning on this line itself, but I get false "Undefined variable" erros in every line that uses something from this import.Īccording to this issue, it seems to be an open, unresolved problem with PyDev.Īccording to the PyDev relase history, however, Release 2.2 "Fixed issue with relative import with wildcards", which makes me very confused.įor the moment I guess I will simply hide "undefined variable" errors, since these will be caught when I actually run the code anyway. The second problem is that relative imports are broken. That solved the problem and the PEP8 warnings are still showing. I cleaned it up with a git checkout - and git clean -f -d. A git status showed almost everything deleted and a lot untracked files. I don't know what this "create project" wizard does differently behind the scenes but as I feared it messed up with my files somehow. I reinstalled Aptana and instead of importing an existing folder as project I created a Django project ( New > Project > PyDev Django Project) and replaced the default new directory with my project's root. utils import *) and consequently all lines that use the imported values.Īlthough I haven't completely solved my problem, I'm posting this as an answer because it does achieve what the title asks for. I also get errors on relative imports (e.g. I don't get any PEP8 warnings for many other stuff though, like dict (extra spaces again), more than 80 characters per line etc. I went to Aptana Studio 3 > Settings… > PyDev > Code Analysis and configured it:Ĭertain things, like method( self ): (notice the spaces) are corrected on save. I then went to Properties > PyDev – PYTHONPATH > Source folders tab > Add source folder, selected the root of my Django project and clicked Apply. workon env_name works perfectly, the pip installations go to the correct site-packages, but the standard library seems to be being accessed in the global python.Īnyway, I therefore included the global python lib folder: I went and checked the lib folder in my virtualenv python installation and indeed these packages/modules were not present, which makes me even more confused about how virtualenv works (I hate these configuration things and I admit that for a long time I have avoided them whenever I could, collaborating to the maintenance of my ignorance). If I proceed anyway, I get all sorts of import errors for standard library packages/modules (e.g. If I click "apply" without changing the default, I get the following error: I was prompted with the following list of folders to choose: I selected the python file in my virtual environment. Then I went on to Properties > PyDev – Interpreter/Grammar and clicked the hyperlink to configure an interpreter not listed. I then right-clicked the project directory and selected PyDev > Set as Django Project. I've tried all sorts of set ups, but I got to my current configuration by doing: File > Import > General – Existing folder as new project I'm on OSX (10.9), I have a Python 2.7 installation on a virtualenv (besides the global one) and Aptana Studio 3. ![]() I've lost count on how many articles I've read both here on SO and elsewhere, but even after trying all suggestions I've had no success, so I decided to post my specific question here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |