spyder profiler uses wrong python - python-2.7

I am using a virtualenv, but I would like to use an IDE. So I pull up spyder and easily I can change the python interpreter to .virtualenv/myenv/.../python
But, when I go to "F10" for to profile my code, Spyder identifies the interpreter in usr/lib/. I couldn't find anywhere in preferences to change this.
How can I make profiler see the correct python interpreter?
-Chris

Hmm it seems like this is a bug, can you post it in the Spyder issue tracker?
You can post an issue from within Spyder itself in the help menu click on "Report issue

Related

Tkinter no $DISPLAY or display name (Berkley pacman project)

I am trying to use Berkley's AI pacman projects.
Specifically this project.
A little bit about me: I'm on Windows 10 using cygwin as my terminal. I have both python and python3 installed as well as both versions of Tkinter and tkinter respectively. This project uses python 2.7. Trying to run the main project using the python pacman.py results in a long trace with the error being '_tkinter.TclError: no display name and no $DISPLAY environment variable'.
Calling echo $DISPLAY outputs an empty string.
I believe this is the most relevant file:
http://ai.berkeley.edu/projects/release/search/v1/001/docs/graphicsUtils.html
I understand this is a relatively specific and difficult issue, but any advice would be greatly appreciated. Thank you in advance!
Edit: I have installed xwin and the relevant packages. I am able to start a server in one terminal with startxwin and then I try to run the same command in another terminal but arrive at the same issue. I believe my problem is that I cannot establish the xwin server as my $DISPLAY.

why im not able to import pygame? [duplicate]

I've downloaded pygame-1.9.1release.tar.gz from the Pygame website. I extracted and installed it and it's working fine in the command line Python interpreter in Terminal (Ubuntu). But I want to install it for some IDE, like PyCharm. How can I do it?
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 it is up to date)
Go to File
Press Settings (Or Ctrl + Alt + S)
Double click on the option that looks like Project: Name_of_Project
Click on Project Interpreter
Choose the interpreter you want to use that includes PyGame as a module
Save your options
And you are ready to go! Here is an alternate (I have never done this, please try to test it)
Add PyGame in the same folder as your PyCharm file (Your PyCharm stuff is always in
a specific file placed by you during installation/upgrade)
Please consider putting your PyCharm stuff inside a folder for easy access.
I hope this helps you!
For PyCharm 2017 do the following:
File - Settings
Double click on your project name
Select Project Interpreter
Click on green + button on the right side of the window
Type Pygame in search window
Click Install package.
Not I'm saying that the answers above won't work, but it might be frustrating to a newbie to do command line magic.
If you are using PyCharm and you are on a Windows 10 machine use the following instructions:
Click on the Windows start menu and type cmd and click on the Command Prompt icon.
Use the command pushd to navigate to your PyCharm project which should be located in your user folder on the C:\ drive. Example: C:\Users\username\PycharmProjects\project name\venv\Scripts.
(If you are unsure go to the settings within PyCharm and navigate to the Python Interpreter settings. This should show you the file path for the interpreter that your project is using. Credit to Anthony Pham for instructions to navigate to interpreter settings.)
HINT: Use copy and paste in the command prompt to paste in the file path.
Use the command pip install pygame and the pip program will handle the rest for you.
Restart you Pycharm and you should now be able to import pygame
Hope this helps. I had a fun time trying to find out the correct way to get it installed, so hopefully this helps someone out in the future.
I just figured it out!
Put the .whl file in C:\Program Files\Anaconda3
While in the folder, click on the blue File tab in the upper left corner of the Window Explorer (assuming you're using Windows)
Click on Open Windows PowerShell as administrator
Write or just copy and paste: py -m pip install pygame
It should start installing
Done!
I hope it works for you. I know it did for me.
I already had pygame installed with python38-32
since its working just fine with it. I used this version of python us my project interpreter.
1.File -settings
2.according to your settings look for project interpreter
3.click on your current project interpreter and click on the add symbol
4.choose system interpreter
5.select the python version thats works with pygame for you
6.Note: some versions of pygame don't work with some versions of python be sure
of what are you doing.
7.hope it works.

pyinstaller issue with requests 'ImportError: No module named 'requests.packages.chardet.sys'

I have encountered this issue and tried all previous solutions to no avail. Have tried rolling back requests to older versions, have tried updating pyinstaller. Please guys, if you know a configuration that works, let me know.
I am compiling some python 2.7 code that uses Kivy
I am an idiot. I was piping the wrong python install. I use a separate version for other projects, and I sandbox my kivy one to prevent conflicts... too bad I forgot about that :)

Is there a way to make aptana 3 autoreload when i make changes to a py file in a django project?

Aptana makes it open in --noreload mode automatically because not doing so causes python instances to remain open or something like that, is there anyway to bypass this problem?
As far as I know, it's not possible to auto-reload .py files within an Aptana Python run/debug configuration (which is what I'm assuming you're doing to get access to the call stack for debugging). I've been using Aptana for Python development for a couple of years, and I've yet to see a way to do this. if someone knows how, please share!

Debugging Django from the command-line

I'm working on debugging Django from the command-line. I'm working with django_extensions, and I have IPython installed and ideally I'd like to be able to extract as much information in the shell as possible. How would I go about this task most efficiently?
As mentioned by Geo manage.py shell is good but since you have django_extensions already installed then Carl's suggestion of manage.py shell_plus is even better... saves a ton of typing.
But, as a third suggestion that is a bit less general, you might also want to check out django-viewtools. I personally tend to use shell_plus, but this might be useful.
If you have django_extensions installed, use
python manage.py shell_plus
to get all of your model classes automatically pre-loaded.
How about:
python manage.py shell
More info here
My favorite ways of debuging django problems is using the ./manage runserver_plus command to the django_extensions. It uses the Werkzeug debuger, which gives you a python shell in the web browser itself. If you want a shell anywhere in the code, just type some bogus python, like a simple a, and you will get a shell when that code is executed.
Another nice tool is ipdb ipython debugger. Its the same as pdb but better (and uses ipython. With this, and runserver_plus, you can insert import ipdb; ipdb.set_trace(), and you will get a ipython shell with an debugger in the same window as you have runserver_plus.
Take a look at http://docs.python.org/library/pdb.html#debugger-commands for a list of commands you can use inside the debugger.