I'm completely new to Python and PyCharm and I cannot figure out why PyCharm doesn't auto-completes very simple cases such as:
import pickle
pickle.dum[control+space or control+shift+space results nothing here]
I have PyCharm 2.6.2 and Python 2.7.1. What's wrong?
Add:
I'm on Mac OS 10.7.3
Can't reproduce. Make sure you have a valid Python interpreter configured for the project. Also try File | Invalidate Caches.
My experience is if you turn ON the File -> Power-Save Mode, all background tasks will be stopped, including the Auto-Complete task.
So you can try turning off the Power-Save Mode.
You could try with a virtualenv and on it install all you project dependencies and the go to pycharm preferences/Project Interpreter and it will update your project dependencies.
Project Inspector
I changed the projector interpreter and it works fine now.
It happened to me, too.
But all the previous answers don't solve my issue.
The weird thing is when I am coding, it will pump out the autocomplete for me. But once I leave the autocomplete mode, I cannot reproduce the autocomplete by typing Ctrl + Space.
So the work I already surveyed are
Make sure the config(e.g., virtualenv) is right in Pycharm
Make sure Pycharm can show autocomplete
Make sure I am not in the Power Safe Mode
Finally I solved this just because my shortcut of switch language in the Mac is also Ctrl + Space, so it's kind of override my shortcut in the Pycharm. I change the shortcut in the Pycharm by changing in Pycharm-> Preference-> Keymap-> Main menu-> Code-> Completion ->Basic
Then the problem is solved
Related
I've attempted to work a bit more in WSL recently (I've got the most up-to-date version of WSL2 and the Windows 11 insider beta, both of which I updated today)
Everything works great! But plotly has been giving me issues. When I run it from within VSCode (making sure Python Interpreter is set to my correct environment), it spits out the following error:
tcgetpgrp failed: Not a tty
It then opens a tab in my default browser, but it just hangs until eventually failing to connect
Alternatively, if I run it directly from the WSL console (no VScode), it still gives the same error as above, but it DOES correctly open a window in my web browser. It also, for some reason, changes the font of the console?
I'm not 100% sure what the problem is here. I've used WSL for awhile, and never had any issues with displaying plots and things as needed (though, historically, I've used matplotlib... this is the first time I've tried using plotly, but I've used it without problem on native linux and native windows).
Has anyone else had this issue? Or one similar to it? Any idea on what might be wrong?
Figured this out after a bit of reading on other projects that use plotly. The fix is actually very simple, and just requires adding:
export BROWSER="/mnt/c/path/to/browser.exe"
To your ~/.bashrc file. For example, for me this was:
export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
I am trying to run a python file for a snake game in PyCharm (Community Edition 2020.2). I am using Python 3.8. When I try to run the file, the Python application tries to open, but is never able to to start the game. I feel like there is something wrong with my interpreter. I used the "which python3" command to figure out where my Python3 was installed and am using that location for my interpreter, but again, the application doesn't open upon running. I have attached a screenshot of my interpreter. Any thoughts on what might be wrong would be great
PyCharm automatically creates a virtual env for your work. That might be the root of your problem. You could look up about that to resolve your problem. I am a bit less familar with virtual-envs. Someone else could give you detailed info but it might be the gist.
So I've been working with Python on my computer for about the last 2 months with no issues. Just recently however, something went wrong with IDLE. I am running python 2.5
I used to be able to right-click and select "Edit with IDLE" for a python program. That option no longer is available. When I try "open with" and navigate to the idlelib in python, I can select idle.bat, idle.py, or idle.py (no console). I've tried each option and each fails to open and returns an error that either it is not a valid Win32 application or that "Windows cannot find idle.pyw"
I am able to open IDLE on its own and use the open function in IDLE to open files, but can't open files directly using IDLE as I could before.
There was formerly the White background icon with the python logo, which is now replace by windows' logo for no program (white square, blue and red dots). I have tried to repair-install and unistall-re-install both with no success. There is no firewall or antivirus, and it was installed with permissions for all users.
Any help is much appreciated, this has been maddeningly difficult to figure out.
The native one that comes with python on windows is problematic at times, so you could uninstall and reinstall it as a solution, or open it from its directory instead of a shortcut, or get another IDE. I recommend the Ninja IDE very nice and light looking, or if you're on linux you could just use vim from terminal.
Also, if it's extremely necessary, try upgrading your python version and IDE. I think the IDE included for windows looks like a modified emacs to be honest.
The fact that Windows changed the right-context menu for .py files has nothing to do with Idle, and probably nothing to do with Python either. You are not the first to have this problem. You can potentially restore 'Edit with Idle' but without directly editing the registry (an expert option) I only knew how to do so in XP. You might also be able to fix it be going back to a restore point before it changed, but you would lose all updates since, so I would not do that.
I am surprised that re-installing did not restore it. The line was once gone for me, too, and was restored by a recent install.
I have Win7. I just now tried 'Open with', navigated to 3.4 idlelib, and selected idle.bat (the .py files were not offered as a choice). The .py file opened in an Idle editor just fine. It is now a permanent option for Open with, without having to navigate.
Idle has gotten perhaps 150 patches since 2.5. Even if you have to edit programs to run on 2.5, I strongly recommend installing a current version of Python and Idle.
I have no ideal what your comment "the programs still can't find anything associated with it, like Tkinter for example " means.
I'm new with python 3.3.
I'm using intellij IDEA 12.1.6.
How can I open the interpreter window, the one with the '>>>' prompt?
Thanks
I am using IntelliJ IDEA 13.1.4 Ultimate with the JetBrains Python Plugin 3.4.135.24.
After installing the plugin and restarting the IDE, I can open the iPython console exactly the same way as in PyCharm, i.e. clicking Tools -> Run Python Console in the menu.
Another option is by selecting some code in a .py file, right clicking and choosing Execute Line/Selection in Console or pressing Alt + Shift + E. If the console has not been opened already, it will open now.
Using the console integrated in the IDE has a few advantages over running iPython alongside it, as listed at in the linked PyCharm documentation page.
Go To Tools -> Python Console
If you want to program python exclusively you may have a look at Intellij's little brother PyCharm. It is specifically designed for python development: http://www.jetbrains.com/pycharm/
Under PyCharm you can open an interactive Python session by selecting Menu->Tools->Run Python Console...
In Intellij (community edition) in terminal (I use Linux, this might differ in your case) I type python3 and it works the same way as in pycharm. With "_" as return value etc. I find this rather useful.
I am new to emacs and I want to use emacs for python development. I am using Ubuntu 9.10. I frustrated to getting emacs work with python. I use GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0).
Here what I did.
*
Emacs come with python mode but it is confusing there are two types of mode one is python-mode.el and other one is python.el. I use emacs 23 so mine is python.el (I think). Do I need python-mode too? Code completion does not work when I press M-Tab , instead of it window manager works. I tried Esc-Tab but it says "No match" . How can I enable code completion?
After that I installed ropemacs
sudo aptitude install python-ropemacs
Then I created .emacs file at ~/.emacs
and I added followings to .emacs file
(require 'pymacs)
(pymacs-load "ropemacs" "rope-")
(setq ropemacs-enable-autoimport t)
Then when I hit M-/ (Alt-/) it doesn't work when I cick from the menu Rope->Code assist it opens a file dialog for choosing root project folder. I choose current folder which has there are some python code. When I try again Code assist from menu it says
"Completion for x: " nothing but empty set. How can make emacs python code completion work?
Then I downloaded anything.el, anything-config, anything-match-plugin to ~/.emacs.d folder Then I added following lines to .emacs file
(require 'anything-config)
(require 'anything-match-plugin)
(global-set-key "\C-ca" 'anything)
(global-set-key "\C-ce" 'anything-for-files)
Guess what it didnt work. I tried "M-x anything" again I get No match.(I guessed may me combination of C-ca (First control-a then e ) might work it says it isnt defined). Could you explain code completion for python with clear explanations (step by step) to someone dummy as me. Thanks.
Edit: I able emacs work with python with the link. Thanks all for answering
I haven't tried anything, and I haven't had much luck with rope (giant source tree causes my emacs to hang upon any file save). Instead, I find the default completion works well enough for my purposes.
The default completion keybinding is M-/. That runs dabbrev-expand which expands the current word to "the most recent, preceding word for which this is a prefix." It's not perfect: It won't parse types, and it won't search imports, but it works in 90% of the cases.
(You'll have to deactivate rope.)
I think you do want the package python-mode installed! The ropemacs variants appears to be for refactoring only, and pymacs is allows Python as an Emacs-extension language -- neither of which is what you need for standard support.
I'm not really sure you had to do anything fancy to get Python development to work. On gNewSense deltah (fork of Ubuntu 8.04) all I did was edit a .py file with the first line being:
#!/usr/bin/python
And then Emacs just figures it out and gives you python mode options. I didn't have to install anything beyond Emacs.
Then again, this may not be helpful as gNewSense pre-installs Emacs by default. I'll have to do it on one of my vanilla Ubuntu installs.
Emacs worked out of the box for me on Ubuntu 9.10.
Did you try C-c TAB (update imports) before trying code completion? I don't think it work unless you do that.