How to get Python files to open into existing Spyder IDE Session - python

I have been using Spyder via Anaconda for some time, and it has always worked that when I double click on a python file it would open up the code into a new tab in my existing Spyder session. This is on Windows, btw.
I tried a different IDE, Canopy, and it was really awful so I uninstalled it, but somehow in that process I cant get Spyder to get synced back up with my .py files.
When I double click on a .py file, with an existing Spyder session, it will boot up a brand new Spyder session every single time, and it will have an empty black Windows window as well. Neither of these two things was happening to me before I tried out the new IDE.
How can I get back to my .py files opening up into my existing Spyder session? I have tried:
making sure 'Use single instance' was enabled in Spyder.
Changing the default app to spyder.exe that is within the Anaconda/Scripts folder
Changing the default app to both python.exe and pythonw.exe in the Anaconda folder

Related

How do import kivy in VS Code?

I've installed Kivy.....a lot of times.
I'm in VS Code and it shows in Libraries but I can't seem to figure out how to import.
Getting kivy module does not exist error.
Can run a .py file with just import kivy in the terminal with success.
Cannot run kivy built-in example from terminal. ErrNo2
You're opening python environment as current project. It's not recommended to do so, and we usually open a folder and select the python environment as interpreter.
Turn back to your question, make sure you've selected the opened environment as interpreter. Open Command Palette, click Python: Select intepreter then enter interpreter path. It will pop up a folder explorer, choose your current opened Scripts\python.exe, then you can import kivy successfully:
More information please view Python Tutorial and Python Environments.

Pycharm IDE is not opening on my Windows 10..Badly need a Suggestion

I used pycharm sometime after installing it for the first time on my windows 10(64 bit)..After some day i tried to open pycharm by double clicking(as usual we open softwares in our pc) but it is loading and after sometime the loading disappears..As this thing happens every time i tried opening pycharm i did the following things:
Restarted my Pc.
Reinstalled Pycharm
But same problem is occurring.
Badly need a help!
I got the same problem after reinstalling PyCharm in my Windows 10 Laptop.
Actually, I had to reset my Laptop due to some Startup problems which removed my previously working PyCharm IDE. After finishing reset of my Laptop, I reinstalled PyCharm and tried to open by double-clicking on Shortcut of its exe file, but failed several times.
Finally, I found a solution as follows:
Go to C:\Users\<usrName> folder and delete or rename .PyCharm[Version.No] folder. Then try to open PyCharm.

Idle and Anaconda

I use to have idle. Then I downloaded Anaconda and opened idle through there. I have not used idle for a while but just recently went to go open it up and use it again. However, it seems I no longer have idle on my computer, to my understanding I can still get to idle through Anaconda but I forgot how. Is there a way to open idle through Anaconda without re-downloading idle? If so what command can I use to pull Idle up?
Search for this folder "idlelib" in the Lib folder of the Anaconda version you have installed and you will find idle (check its file type: "compiled python file").
Pin it to your taskbar and run.
You are looking for C:\... <\> ...Anaconda3\Lib\idlelib\idle.bat
There is also C:\ ... <\> ...Anaconda3\Scripts\idle.exe which seems to run a little smoother, but there has to be a Command Prompt open in the background to run. ... ?
Navigate to your Anaconda3 installation folder. Yours could be anywhere, mine is at "C:\ProgramData\Anaconda3", but I installed for all users and you could have selected a random location on your drive. If you managed to add it to the environment variables you could easily find it by running the Command Prompt (not Powershell - has to be Command Prompt) and typing where conda or where anaconda and pressing enter. You should find a folder named Anaconda3 or something of that nature.
If you navigate to this folder, and within it find the "Anaconda3\Lib\idlelib\" folder, within it there is a file called "idle.bat". If you find this "Anaconda3\Lib\idlelib\idle.bat" file you can double click it to run IDLE, although it may be a little messy/outdated/glitchy/strange since you are updating all kinds of folders within Anaconda and some of them may have helped idle.bat run. Mine has a the spyder icon associated with it in the task bar and a blotted out IDLE icon in the top left corner for some reason. You could of course run the full path in command prompt as well if you already know where it is, for instance I would run...
C:\Users\Thomas>C:\ProgramData\Anaconda3\Lib\idlelib\idle.bat
~or~
C:\Users\Thomas>C:\ProgramData\Anaconda3\Scripts\idle.exe
--> It may be easier to just download a new version of Python side by side with Anaconda to run IDLE. I have been attempting to set a shortcut in the Start Menu that runs from anaconda properly for days and have failed. This way, there should be a right click>'run with IDLE' option for python files.
I believe the tilde slash (~/) was meant to imply your home directory since that is what it signifies on a linux machine, but seeing as you could have put it anywhere on the machine, even directly on the C:\ drive, maybe he meant 'unknown file path'.
If you are running MacOs (currently I am on Catalina - MacOs10.15) it is quite simple to run IDLE from Anaconda environment:
Launch Anaconda
Go to MacOs Terminal.
Type IDLE3
warning: if you type IDLE, the Python 2 IDLE will be opened ... but if you are using Python3 installed with Anaconda ... it doesn't work properly.

How to open ipynb files into browser by double-click

Previously, I had Canopy installed and at that time, I could simply double click on ipynb files and open them into the browser.
However, later I needed Anaconda and once I installed it, this feature was gone.
Now I just want to be able to simply double click on ipynb files and the file gets open into the Firefox. Is it possible?
I read about this:
nbopen
pip install nbopen
python -m nbopen.install_win
But it didn't solve my problem. I appreciate any help.
Yes, this is possible. Running python -m nbopen.install_win installs the executable nbopen.exe in the Scripts folder of your anaconda directory. For me this is:
PS> (gcm nbopen).Path
E:\Programs\anaconda\Scripts\nbopen.exe
The first line gets the path of the nbopen command (using PowerShell). If you are not using PowerShell you can find your conda directory by right-clicking on any (I)Python executable in your start menu and look at where it links to.
You can then associate the nbopen.exe file with the .ipynb filetype:
Right-click on a .ipynb file.
Click on Properties
Click on the Change button next to "Open With:"
Click on Browse, browse to the path you found out and select nbopen.exe.
Double-clicking on .ipynb files now checks if a notebook server is running and opens the notebook. If no server is running, one is started in the active directory.
Checkout this Firefox plugin. Python Notebook Viewer.
This plugin lets you view/render python notebooks without running notebook server. Once installed, set Firefox as default app to open ipynb files. From now onwards, you can simply open ipynb files by simply double clicking on it!
This saves a lot of time as most of the time developers are just keen on seeing a code. It also saves a hassle of browsing directories in Jupyter Notebook window to reach to a specific file.
If m00am's solution doesn't work and nbopen.exe file doesn't show up then do the following:
Uninstall Anaconda.
Install Anaconda again and make sure you add Anaconda to Windows path during the installation.
Then try m00am's solution again.
This worked for me:)

Edit with IDLE option is not available after installing Python 2.7 alongside Python 3.5. What should be done?

My IDLE option in the right click menu has disappeared.
I think it's because I use Python 3.5.2, but I installed Python 2.7.12 without uninstalling Python 3.5.2. Later I uninstalled Python 2.7.12 and from then on the .py files are opening in either Chrome but I cannot get it to open with IDLE. And the usual logo for Python scripts has disappeared. Instead now it has the logo in the picture. What can I do? I uninstalled Python 3.5 after the problem and reinstalled it. Yet the problem persists.
An alternative approach would be to modify your Python installation. I would advice against reinstalling Python because you stand to lose your installed modules and scripts. But if you don't mind starting over again, reinstalling Python will fix this.
To modify your Python installation:
Open the Control Panel.
Uninstall Python Launcher.
Click on Python 3.6 (or the version you
have.)
Choose Modify.
On the Optional Features page, make sure the
.py launcher checkbox is checked.
Proceed and wait for the setup to finish.
After it's done, you can either restart your computer or
sign out then sign in.
Now when you right click on your .py files, Edit With IDLE will show up in the context menu. Keep in mind that your .py files should Open With Python Launcher.
Hope this helps.
Option 1:
Right click on any .py file and click Open With and click choose default Program or Choose another app.
From the list that appears after if you see python.exe choose that otherwise click Choose another program or Browse option. Might that option appears after clicking More App in Windows 10.
Next browse to python insallation directory and select python.exe
Option 2:
Run regedit and goto key HKEY_CLASSES_ROOT\.py and change the default to Python.File.
After that logout & login. Context menu will appear again.
At time of saving python code...will display two extensions .py and .pyw.
Save file using .pyw extension, i.e. instead of dropcols.py save it as dropcols.pywwill solve your problem. This worked for me.

Categories