New python interpreter opens upon importing a package (control) - python

This is my first post so be gentle! I'm also in the process of learning python independently (trying to make engineering-related webapps using flask).
I have set up a project using virtualenv, and I've used the virtualenv-associated pip (what do I call this?) to install control.
Now, when trying to play around with the control package to play around with it, I am running an instance of the virtualenv's python3 interpreter (I've tried doing this by using the python3 command with the virtualenv activated, and by executing the project's proj/bin/python3 command) and I import control.
Oddly, this opens another python interpreter running on my desktop. Here's the
icon that appears on the mac doc.
Why is this second interpreter opening upon importing the control module?
Thanks for any help!

Related

Contents of /usr/bin from subprocess.Popen different than from terminal

I am attempting to create an application for changing the wallpaper with gnome-builder. I've chosen to create this application in Python, and figured that I could do this using subprocess.Popen(["hsetroot", ...]) however every time I try this I get the following error:FileNotFoundError: [Errno 2] No such file or directory: 'hsetroot'.
This confused me because I know that hsetroot is installed and running the same command from the terminal works. I decided to do some investigating, and listed the contents of /usr/bin from the terminal using ls /usr/bin. Among the list I found hsetroot. I did the same thing in the Python script with subprocess.Popen(["ls", "/usr/bin"]) and upon checking the list of programs, hsetroot was not there.
Why is hsetroot seemingly gone when I try running it from a Python script with subprocess.Popen() and how do I fix this? I apologize if it is obvious, I have been searching for the answer for over a day now and I am completely stumped.
On Debian GNU/Linux 11, I am running the application using GNOME Builder's built-in run button. GNOME Builder was installed via apt-get install gnome-builder. From there I created a new python project using the "GNOME Application" template. In the project I am attempting to use subprocess.Popen() from src/window.py.

Windows Python 3.9, pip, vscode not working correctly tried every tutorial

I've gotten this to work relatively easy on my Mac I with django but for some reason Windows has been a heartache.
the problem is that in the console I can only get py to start executing python.
python and python3 do not work whatsoever
and also I can't get pip to install either because the py command won't execute it but python and python3 just open the windows store.
I've installed python to the path with the installer and I made the location of the file C:\Python\Python39
changed the hierarchy in the PATH in user variables and system variables to where python is at the top in both.
I've edited the vscode settings
I've also turned off the App execution aliases. That did nothing.
I'm at a complete loss so if any one has any advice I'd be so appreciative.
This tutorial helped me make pip working when I started programing
https://youtu.be/28eLP22SMTA

Arrow up / previous command in VSCode Python Interactive not working

I'm working with VSCode on an Ubuntu 18.04 machine. Everything is fine except that I can't get back to the previous command in Python Interactive Window via Arrow Up. It works in the integrated terminal though, integrated shell is /bin/bash.
I have no idea where this is coming from. I changed "keyboard.dispatch" to "keyCode", but that's not the problem. I also tried different versions of the python-extension.
Do you have any idea?
Thanks!
Not sure if this is helpful for you as an Ubuntu user, but I came across the same problem in Windows this week. In my case, the issue cropped up after I installed the Python extension in VS Code (or at least I didn't notice the issue before this). The combination of using the Python extension, Git Bash for terminal, and python virtual environment killed the up arrow feature for me. Using python outside a virtual environment works fine. My solution was to use Command Prompt as the terminal when I wanted to use a virtual environment interactively.
In my situation, although I delete all the shortcuts of UpArrow, I still can get the previous command through UpArrow in Python interactive. This means there's no way to configure this shortcut, it was built in the plugin which built in Python extension.
So it's some problem with your Python extension, but you said you have tried to install a different version of Python extension but still not work. Make sure you have deleted it completely -> delete the extension folder manually(it's under C:\Users[UserName].vscode\extensions\ms-python.python-xxx).

How to make VS Code update the Python autocomplete and installed modules caches?

VS Code will recognize available python packages and modules.
In this case, I started a VS Code session without a python package installed.
I then opened a terminal (in VS Code) and ran a pip install command to install the missing packages (the python interpreter for this project is set to a virtualenv that lives inside my project directory). However, VS Code still shows these packages as unresolved.
If I close and reopen VS Code, it picks up the new packages. Is there a better way of getting VS Code to automatically pick up these changes than restarting?
Probably similar to restarting but Ctrl+Shift+P > Reload Window should do it, without clearing your opened files

Force eclipse to reload Python modules

I have started a Eclipse PyDev project, and found out that BeautifulSoup was missing.
I installed it using easy_install, and now the scripts runs fine from the command line. Eclipse, however, still thinks that BeautifulSoup isn't installed, displaying an annoying error message and not supplying any introspection or auto complete.
How can I force Eclipse to reload the system's python package list?
You have to reconfigure the python interpreters. Normally the automatic configuration utility should discover everything by itself, but otherwise you can manually add/remove packages. Here's a screenshot of where the settings are located:
In the only occasion in which I can recall I needed to do that, all I did was to remove the python interpreter from the list and running the Auto Config procedure again, but it should also be possible to simply add a library (bottom half of the screenshot).
HTH!

Categories

Resources