IPython reloading modified module - ipython

I'm running ipython in Linux terminal. Every time I change my source file I need to restart it; otherwise it uses the old version. I have seen this but it doesn't offer a firm answer. I was wondering if there is anything I could do?

Please see if this helps. We can use autoreload in IPython to make it reload files before executing any new lines.

Related

python interpreter citing zen of python in the terminal window

I run vscode version 1.65.2.
Today it started citing the whole "The Zen of Python" in the terminal window every time I run a python script in the debugger.
EDIT: It turns out that it is the python interpreter that does it, not vscode. The problem apparently came after I updated ipykernel to version 6.11.0. I run python version 3.9.1 on Windows.
How can I turn it off?
I havent been able to find an answer to this anywhere.
It turned out that an import statement had found its way into my code: "import this as d", and removing it solved the problem. It is a mystery how it ended up there, I certainly haven't put it there knowingly. But problem solved!
That's really odd. I just had the exact same thing. Even the import this as d was on the first line before everything. I use vscode as well. Removing it does help. But I didn't update a kernel prior to this. It happened while I was writing code I think. Python 3.8.10 on Linux.

Fish seems to remember things through reinstallation

I'm trying to troubleshoot something with fish shell, so I uninstalled it from my Mac, including deleting everything from ~/.config/fish and reinstalled it. I found that it seems to remember some things, such as its autocomplete history. Is there some file I've missed in the uninstall process? Or is fish sharing autocomplete/history data with zsh?
The documentation says:
By default interactive commands are logged to $XDG_DATA_HOME/fish/fish_history (typically ~/.local/share/fish/fish_history)

Can you take terminal commands and use them in a Python program?

In another thread, there is an excellent step by step to completely uninstall VSCode off my Mac so I could truly start over. The steps work perfectly. In my question to try a lot of configurations and extensions, I mess up VSCode pretty often.
Is there a way to build Python file so when I need to uninstall, I can open a terminal window and run a program and be ready to try again? It is not the end of the world to have to type one line at a time, I'm just assuming this is common and been fixed. I'm just not able to find the how.
After doing some studying of Python, I found the OS module. Once you import it, most, if not all the commands to clean up directories, delete files, etc. are in there. I took the list of commands that ran in a ZSH terminal and converted them to os.[relevantcommand] and it worked fine. Now, I can easily clean out a VSCode install by running my VSCleanup.py and start over.

pylab backend from cmd prompt?

I've run into an issue...
First, I've been trying (with little success yet) of 'packaging' a Canopy python file into an .exe. I'm trying to make a 'simple' way to run our program(s) for our client.
With those issues, I thought I'd make a .cmd file with 'python myprog.py' in it. Well, it fires up my code without having the Canopy environment there to confuse my end-users, BUT, it appears that the PyLab backend isn't Qt4, as the screen appears quite a bit different, and the actual program doesn't quite run the same :(
Is there some way to tell Canopy that when I start a program using 'python xxx.py' that it should be using the Qt4 package? I've looked at the Preferences for Canopy, and both the Notebook tab and the Python tab have the PyLab backend set to Interactive (Qt4)? If I can find that and get my panels to look the same as in the Canopy environment, I'll see if the rest of the program straightens out too.
Steve, if you wish you can hard-code this into your program, but as a quick solution, precede your python call with:
set ETS_TOOLKIT=qt4

How do I run a .py module in Aptana?

Every time I try to run a .py module it just opens in Firefox.
I'm running Aptana in OS X 10.6
If you installed and configured PyDev, it should work.
Make sure you use the correct "Run" command. Prefer "Run as Python module", avoid "Run on Server".
If that doesn't help, edit your question and give an exact example what you do (which menus/buttons you click, etc).
See: http://pydev.org/manual_101_run.html for details on running a Python module (make sure you read the whole getting started: http://pydev.org/manual_101_root.html which should help you in getting your environment setup and gives some tips to properly use PyDev).
I used a same workspace for both python and java , and met the same problem.
If I change a new workspace, the Run As works. So i think there is something wrong with workspace settings.