You need to designate an interpreter for the project. File -> Settings -> Project -> Project Interpreter, and then select an interpreter at the right. It looks like this on PyCharm Community Edition 4.0.3: The official JetBrains guide to setting up an interpreter can be found here....
Ok, I found the problem. Problem was that PyCharm also have module named utils, and so the import was not using my module, but the PyCharm's one.
intellij-idea,vertical-alignment,pycharm
I think that "Emacs Tab" could help you. You can use setting search to find it or you can go Preferences -> Appearance & Behaviour -> Keymap. It is editor action and in some Keymap settings it doesn't have assigned key shortcut. I personally prefer remap Tab key to this...
python,python-2.7,terminal,pygame,pycharm
Well, you don't have to download it for PyCharm here. You probably know how it checks your code. Through the interpreter! You don't need to use complex command lines or anything like that. You need to is: Download the appropriate interpreter with PyGame included Open your PyCharm IDE (Make sure...
You can install this library from PyCharm via Settings | Project | Project Interpreter | Available Packages. AFAIK, the library is called midi. Alternatively, you can install "midi" using the "pip" command line tool....
python,pycharm,multiline,heredoc,trailing-character
This isn't really a bug in PyCharm; it's a limitation of its "Strip trailing spaces on save" feature, which is not context-sensitive and strips trailing spaces in all lines. You can turn it off under Settings | Editor | General. Alternatively, you can encode the trailing spaces in your heredoc...
UTF-8 is sometimes painful. I created a file with a line in Latin caracters and another one with Russian ones. The following code: # encoding: utf-8 with open("testing.txt", "r", encoding='utf-8') as f: line = f.read() print(line) outputs in PyCharm Note the two encoding entries Since you are getting data from...
python,autocomplete,ide,pycharm,type-hinting
Unfortunately, this is a defect in PyCharm right now. See: https://youtrack.jetbrains.com/issue/PY-12870...
You can not auto format Python code because the indentation defines the scope. This cannot automaticly guessed. For example for C, C++ and C# the scope is defined using { and } the identation does not really matter. So there you can auto format....
python,google-app-engine,pycharm,wtforms
You need to install it in in your environment(according to the comments you didn't), please try the following: Settings -> Project: MyProjectName -> Project Interpreter Then click on the green plus and choose your packages...
python,qt,matplotlib,ssh,pycharm
what worked is, I installed a GUI in the remote system. Then installed vnc and configured it by running vncserver. Which gives a display number, say 5.0. I then put the environment variable in PyCharm to DISPLAY=:5.0 in the project settings. That worked, and any plot command goes to that...
In PyCharm, go to file > settings > project > project interpreter Select the python interpreter you want to use from the project interpreter dropdown. Click on the green + button on the top left to add packages to the interpreter. On the search box, type in PyAudio. Select the...
python,docker,pycharm,remote-debugging,boot2docker
Okay so to answer your question(s): In PyCharm, I can set a remote python interpreter via SSH but I'm not sure how to do it for dockers that can only be accessed via Boot2Docker? You need: To ensure that you have SSH running in your container There are many base...
You need to sudo apt-get install python-dev to install the python header files.
Right click in context menu and click Run 'your_script' or press Ctrl+Shift+F10 Found here: https://www.jetbrains.com/pycharm/quickstart/ ...
Quoting PEP-8's Programming Recommendations section, For sequences, (strings, lists, tuples), use the fact that empty sequences are false. Yes: if not seq: if seq: No: if len(seq) if not len(seq) Since empty sequences are Falsy in Python, >>> bool([]) False >>> bool(()) False you can simply use if not as...
Maybe this code ran in different environments, in Pycharm you can set separate environment by virtualenv for running your project
You can create a scratch file by going to "Tools" -> "New Scratch File..." This presents you with the "New Scratch" dialog If you are a fan of keyboard short cuts, the default for this is Ctrl+Alt+Shift+Insert. This key combination can be modified by going to "File" -> "Settings" ->...
Your comment doesn't fit the requirements of the PEP because you left a space between the word encoding and the colon: # -*- encoding : utf-8 -*- # ^ The PEP specifies the exact regular expression used to match the declaration: coding[:=]\s*([-\w.]+) So Python looks for the literal text coding...
You need to block the execution of the program after you call window.show() so that the window object remains active otherwise it will be garbage collected. app.exec_() does this for you. {__author__ = 'Jay' import sys from PyQt4 import QtGui app = QtGui.QApplication(sys.argv) window = QtGui.QWidget() window.show() app.exec_()} # added...
Turns out, changing my terminal shell path in pyCharms settings (In the menu bar, pyCharm --> Preferences --> tools --> terminal --> Shell Path) to the correct thing: > echo $PATH # whatever this spits out in terminal is your shell path fixed everything :)...
Your issue is it thinks you are calling the objects Yann and Bob when in reality you ment that they were strings. Try this: stu1 = Student("Yann", 1, 67,98) stu2 = Student("Bob", 2, 42, 12) ...
You should add your source root directory to PYTHONPATH: export PYTHONPATH="${PYTHONPATH}:/your/source/root" ...
python,dynamic,properties,pycharm,typing
You are calling the property on the class itself, rather than on the instance of the class that you get inside the loop. It should be: for filetocopy in self.files_to_copy: shutil.copy2(filetocopy.get_source, filetocopy.get_target) (Also, please choose better names; get_source implies a method that you call, the property should just be source.)...
Yes, there is. When google released their c++ coding style, they also provide a python script named cpplint for style checking. http://google-styleguide.googlecode.com/svn/trunk/cpplint/ If you can embed this script into your IDE, you can employ it to do code style checking. There is an article that explains how to integrate cpplint...
intellij-idea,phpstorm,pycharm,webstorm
It's not possible to hide those paths. https://youtrack.jetbrains.com/issue/IDEABKL-4374 -- watch this ticket (star/vote/comment) to get notified on progress. Please note that the aforementioned ticket is in "Backlog" section -- such tickets are unlikely to be implemented in nearest future (especially if they have virtually no votes)....
You can use Ctrl-Shift-F7 to highlight the usages of the variable under caret and then use F3/Shift-F3 to navigate between the usages.
Simplified version of your regex would be src="(.+?)". Instead, you can use the following to match src="/static/(.+?)" And replace with src="{% static '\1' %} ...
Please use hashlib, in any case. sha has long been deprecated.
The webapp directory, as shown, is not a Python package. It does not contain an __init__.py file, therefore it cannot be included in an import path. You appear to have set up your Python path so that the webapp directory is on the path, which is why packages under it...
Here is how you can fix this issue specifically for pygame: Go to your pygame folder and open __init__.py in a text editor Navigate to the import section with the try/except clauses (around line 109) Change the format from import pygame.module to from pygame import module for the modules you...
Seems like PyCharm doesn't have any way of exporting local history, and JetBrains doesn't plan to add this functionality in the foreseeable future. Source...
The author used windows 8 and Python 3.4. mysql-python is not compatible with Python 3.x. Please use mysqlclient pip install mysqlclient ...
python,coding-style,documentation,pycharm,docstring
We use it with sphinx-apidoc to generate our HTML and PDF documentation. Here's an example how I use the docstrings: def add_pdr(process, userid, log): """ Create and perform the target account operation PDR If the function/method is complex, I'd put a short one-line summary in the first line above, and...
1) Bulbs are just kind of assistance. They doesn't say "fix me", but "need help?". 2) In Java, it's conventional to code in camel case. Python doesn't work that way. just disable PEP8 naming conventions violation in Editor → Inspections → Python Also other things like to much white space,...
You can create a Live Template Under File->Settings->Editor->Live Templates Look for Python Click + to add, I then name mine "class" and make sure to add a context in the gui for Python files. The Template Text : class $class_name$: """$class_docstring$""" def __init__(self, $args$): """$init_docstring$""" pass def __eq__(self, $other$): if...
python,python-2.7,beautifulsoup,pycharm
folders.append(str(image)) returns nothing (None), so the program would raise an exception and skip your print statements. You can solve it simply by replacing your new_src = '_'.join(folders.append(str(image))) with two following lines: folders.append(str(image)) new_src = '_'.join(folders) If you catch exception by except Exception as e: and print e, you will see...
python,python-3.x,sqlite3,pycharm,bottle
if active_session: cursor.execute("SELECT usernick FROM sessions WHERE sessionid=?", (active_session, )) active_user = cursor.fetchone() return active_user[0] if active_user else active_user ...
I will assume you already have an interpreter for PyCharm. To be able to let PyCharm recognize PyGame, you will need to have download an interpreter that has PyGame installed with it. There is no other way. Maybe go to Google and find the right interpreter that has PyGame included...
python,class,pycharm,ironpython,self
It is a IronPython Bug It does not happen while using CPython Thanks @yole...
This is because the file is empty. Go to File -> Settings -> Editor -> General, and review the settings (under 'Smart keys', 'Appearance', and the other sub-menus). The file will be re-populated with any changes you made. If you are OK with using configuration defaults for the editor, just...
Try disabling anti-aliasing using the setting "Use anti-aliased font". I have the same problem with a different font and this oddly works for me.
Well it turns out I am just a idiot. Though I have seen people in the debug menu complaining about the same problem. You are debugging. The breakpoint does not change to indicate you have hit that line like visual studio. Instead one of your lines will change a light...
Make sure you've installed Apple's Java for OS X 2014-001 (at least). Try to delete ~/Library/Java/Extensions, see the issue IDEA-137147....
python,debugging,twisted,pycharm
On OS X, /usr/bin/twistd is a version of Twisted installed into the system python. This is not python 3.4. The symptom you're seeing is not the missing _preamble module (which is in fact not supposed to be installed, which is why there is an except block around that import catching...
I've also been encountering freezing with 4.0.5 on OSX. Tried removing my old projects created with the previous version of PyCharm and recreating them with 4.0.5 but no effect. I'm trying to find a download for an older version of PyCharm 4 but the previous release page only has version...
I think it's opinion based, but I will share rules that I try to follow: 1. Declare all instance variables in constructor, even if they are not set yet def __init__(self, name): self.name = name self.lname = None Do not do any logic in the constructor. You will benefit from...
Try PyCharm preferences. Project: --> Project Interpreter --> --> Ensure the correct python environment Also double check your settings under Build, Execution, Deployment --> Console --> Python Console ...
I add dir(variablename) to the watch window to achieve this. If it's not visible, activate it with Alt+5 (or View/Tool Windows/Debug). Another option is to use "Evaluate Expression" (Alt+F8) and do the same Using Community Edition 4.0.4 on Windows 7 SP1 x64 if that should matter....
I couldn't find answer anywhere, so I just completely reinstalled PyCharm without import IDE settings and removed project settings in project folder. Now “unused imports” highlighted....
eclipse,full-text-search,pycharm
When View tool window is active (View -> Tool Windows -> Find (Alt+3)) there's Recent find usages (Ctrl+E) option in the context menu. It seems Pycharm does not remember excluded results, though.
python,python-3.x,matplotlib,pycharm
You need to do those two things in other order, see the source code for the picture for an example.
Change the path in PyCharm (in Options). PyCharm shows the first one it sees, and the IDLE shows the one you are using currently.
The feature is called "Quick Documentation" and the default shortcut for this is CTRL+Q or ALT+MOUSE BUTTON 2. As far as I know, there is no way to enable it on-hover (personally, I found this very annoying in Eclipse)....
Did you work with Visual Studio for some time? the concept of start up project does not exist in pycharm. When you open a project, you can add more projects on the same window, and you can run each .py file whenever you like. Use alt+shift+f10 to choose the file...
python,django,unit-testing,pycharm
The problem is that PyCharm doesn't apply the given search pattern for test files (-p "*_tests.py"). It's a bug that has already been reported: https://youtrack.jetbrains.com/issue/PY-15869 The solution has been to simply rename my files :P...
PyCharm added some functionality similar to Spyder's Variable Explorer some months ago, as can be seen in this blog post. However, as far as I know, it doesn't have the ability to import/export the variables present in its Python console....
I got the same error and ended up using a pre-built distribution of numpy available in SourceForge (similarly, a distribution of matplotlib can be obtained). Builds for both 32-bit 2.7 and 3.3/3.4 are available. PyCharm detected them straight away, of course....
android,python,gps,pycharm,kivy
According to the Support matrix for Plyer's features, GPS is only supported on Android and iOS, not on (desktop) Mac, Windows, or Linux. This isn't surprising, as most Mac, Windows, and Linux desktop/laptop/server boxes don't have GPS hardware. And the OS's don't have a standard "location-services"-type API to access GPS...
package name is datatypes, you use from datatype import DataType It should be: # imports module datatype from datatypes import datatype as dt # uses class DataType dt.DataType Update: I added another package name test and module datatype.py under it. and try all import possibilities, all of them can be...
Do you have your project root in the list of interpreter paths (Settings| Project Interpreter| Press Cogwheel| More| Show paths for the selected interpreter)? If yes, it's the following known issue https://youtrack.jetbrains.com/issue/PY-9285. You can follow it for updates, see howto: http://intellij-support.jetbrains.com/entries/23368682....
Seems like an error to me. I don't know where method 'all' can't be used with many-to-many relations if intermediate model is used. is coming from, but I'm not finding it in Django docs. In fact, Django docs uses it in an example, in the section "Extra fields on many-to-many...
At the upper-right corner (by default) of PyCharm you can edit the configuration for your server: In there specify as host 0.0.0.0. Don't forget to take care of your firewall/NAT by opening and forwarding the appropriate ports....
Well, I managed to hack myself around this for my test purposes. Instead of using the assertEqual method from unittest, I wrote my own and use that inside the unittest test cases. On failure, it gives me the full texts and the PyCharm diff viewer also shows the full diff...
python,python-2.7,virtualenv,pycharm
Navigate to the Scripts folder inside your virtual environment. Activate the environment by entering activate.bat Download the 64bit version of pycrypto found here Copy the pycrypto .exe file to the Scripts folder of your virtual environment. Install it by entering easy_install <name_of_your_pycrypto_install_file>.exe The answer was found by looking at...
Just ignore PyCharm, it is being obtuse. The remark clearly doesn't apply when the operands cannot just be swapped. The hint works for numeric operands because a + b produces the same result as b + a, but for strings addition is not communicative and PyCharm should just keep out...
intellij-idea,contextmenu,pycharm
There is no feature in PyCharm that would allow you to set this up through the UI. You can write a plugin that will create the necessary structure for you. PyCharm plugins are written in Java; see here for plugin development documentation.
Without all of the required information, my guess would be that this is due to Python buffering its output, which is its default behavior. You can easily disable this by passing python the -u flag or by setting the PYTHONUNBUFFERED environment variable. This is described in this SO answer....
intellij-idea,pycharm,intellij-plugin
You need to mark your plugin descriptor as compatible with IDEs other than IntelliJ IDEA, by adding the correct <depends> tag. See the documentation for more information.
But putting it in __init__, you instantiate the widget before its kv rule has been loaded, and so this rule is not applied. I would leave it in the build method and ignore the pycharm warning. Edit: Actually, an appropriate way to resolve the warning may be to add 'self.mgw...
Thanks to @Leistungsabfall, here is a working solution :-) import os, sys sys.path.append(os.path.join('/Users/user1/gitroot/website1/web', 'myproject')) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings") from django.conf import settings from website.models import * ...
I think you have two options, pass the list or a function that modifies the list to the secondary window. For example this is how the function could be passed: class Main(): def __init__(self): s = Secondary(self.modify_list) mylist = [] . . s.run() . . def modify_list(self, new_values): mylist =...
Those code insight features are attached to specific full-qualified function names from the Django implementation. It's unfortunately not currently possible to enable those features for a function in your own project.
python-3.x,scipy,pycharm,anaconda
Explanations how to configure PyCharm with Anaconda can be found in the documentation. In PyCharm preferences you can just select the correct python interpreter under, Project Interpreter > Python Interpreters As pointed out by @Cecilia, in the case when a virtual environment (e.g. named py3k) is used with Anaconda, the...
python,autocomplete,pyqt4,pycharm
In one final act of desperation I tried installing SIP and PyQt4 directly in the virtualenv and now autocomplete works! So basically I: Activated the virtualenv through the command line Made the dist-packages folder in the lib folder in the virtualenv. You can probably call this folder anything you want....
intellij-idea,reactjs,pycharm,webstorm
All WebStorm features are available in PyCharm, though some of them are available as free plugins, e.g. Node.js. For JSX support, switch the JavaScript version to JSX Harmony in Preferences | Languages & Frameworks | JavaScript.
Settings | Appearance & Behavior | Appearance | Theme
I need only three first columns You can use the following for matching first 3 columns: ^('?)[^']*\1,(?:[^']*'[^']*'){2} See DEMO...
After seeing this phenomenon again, I did some more digging. After setting certain folders as source roots and restarting PyCharm, these reference warnings went away. I think this is a bug in PyCharm.
No. Similar question: How to find all unused methods of a class in PyCharm? See JetBrains staff answer about unused methods in PyCharm...
You can find out, where a package is located by doing so: import numpy.random print numpy.random.__file__ In your case, it seems that the main parts of the module are implemented in C. You can see in the directory, that there is a file "mtrand.so" located in it. This is a...
PyCharm is written in Java, and there is no API for accessing its internal code representation from a Python program. If you really want to do this, you can build a plugin for PyCharm that will expose the information in the way that you'll be able to consume, but this...
I mean, how does Python carry out the different of number type in the result of 98*76 or 987654321*123457789, does Python detect some out of range error and try another number type? Pretty much. The source code for integer multiplication can be found in intobject.c. It multiplies the integers...
How did you install the required packages? With the conda instructions, or via pip? The error you are seeing there is because CLookupPWA and compute_normals are compiled Python extensions that need to be built before the package can be loaded. The easiest way to do this is to use the...
python,python-2.7,pycharm,anaconda
Anaconda installs a completely separate Python, so there is no need to do anything with the old one. The Anaconda installer sets the PATH variable automatically. As to the packages, your best bet if there is a package you need that doesn't come with Anaconda is to install it with...
Loading the app registry is part of the django.setup method. If the app registry is not loaded when you start using the console, the most likely reason is that it is a plain python console instead of a fully blown Django console. Try the following code. If that solves it,...
python,sqlite,flask,sqlalchemy,pycharm
Thank you both so much for your answers! They led me on the path to figuring out what was up and you where very close! I had to change theRun/Debug Configurations that open up when you click on my Project in the upper right corner and edit configurations. there i...
I finally solved the problem. I think it all started because the first project that I opened with pycharm was in my "download" folder, so the working directory was automatically set to a temporal folder by default and allthough I moved the project to another folder and I manually changed...
So i got the desired result by this macros: $FileParentDir(coffee)$/js/$FileDirPathFromParent(coffee)$ ...
python,django,django-models,pycharm
You don't need to use sql command. Assuming you have your database information correctly set up in settings.py, your python manage.py ... will be able to do everything for you. In this case you would do python manage.py makemigrations mycompany followed by python manage.py migrate....
Press here (small gray arroy pointing down near settings button on tools panel above editor) Choose 'Edit Configuration' There you can choose what tests pycharm should run and when. Probably there set All in folder button, choose another option like script Also you should check bottom part of your file,...
Create a configuration. For the simple app you show, all you need to do is execute flaskapp.py. Right click on flaskapp.py and chose "Create 'flaskapp'". You can chose "Edit Configurations..." from the dropdown to the left of the run button to edit the configuration that's created.
You've installed the 3rd-party library into a virtualenv, but PyCharm doesn't know about that by default. If nothing is specified, it will choose the system Python install as the interpreter. You need to go into the project settings and configure the interpreter to point at the virtualenv. PyCharm will then...