Python, Rodeo gives "Unable to execute" error - python

I have python 3.5 installed on my Windows 10 system. I am using Rodeo 2.5.2 as the interpreter. I had written a python code >800-900 lines on the same. When I try to select it all and trigger it, it just says "Unable to Execute" and shows nothing else whereas when I try to select ~100-200 lines and then run it chunk by chunk it works fine. I am not able to understand why this is happening & how to solve this.

Check if you have some functions which are not being used in the main function.
I had a similar issue and it was resolved as soon as I erased all the functions which were useless and didn't appear in my main function
Good Luck

Related

VS Code continuing to run a Python script using an outdated Python interpreter, even after specifying intended interpreter

So using the Command Palette, I specified my intended Python interpreter already. This is reflected correctly in the status bar on the bottom left.
However, when I run the code above, it attempts to use another Python interpreter. This is clearly reflected in the Python error - it tries to run a Python 2.7 interpreter, and so it tells me that I need to install xlrd, even though I already have it installed in the right Python interpreter.
Can't seem to find anyone else having similar problems. The exact same code runs fine in another IDE like Spyder.
When i do:
import sys
print(sys.version)
It shows me the right version.
My code actually runs when I run each cell individually. It's when I run everything together (Ctrl-Alt-N) where I start seeing this error.
It's because you're executing code using the Code Runner extension instead of the Python extension. If you disable Code Runner for your workspace and then use the Python extension (the Play button will be green in this case) then it will use the interpreter shown in your status bar.

Python fails silently

I am trying to get started with Python, so I installed Python 3.8, from python.org (on Windows 10). I remembered to check the "Add to PATH" during the installation and I have confirmed that it has been added to path, as seen in the first image.
However, when I try to use any commands, whether it be python --version or python HelloWorld.py, nothing happens. I have tried both the traditional command line as well as Powershell. I have also tried replacing python with python3, the result is the same. As you can see in the second image, I get no errors, just a blank line. So it's not that it cannot find Python at all, it rather seems that something is wrong with the installation.
Have anyone else encountered this kind of behavior? I have tried re-installing Python as well as removing old installations.
Image 1: Python seems to be correctly added to PATH.
Image 2: Python fails to return any output. But also no error. Same thing happens with python HelloWorld.py.
Update 1 - Here is what I have tried so far:
Changing PATH to refer directly to exe file.
Using both Command Prompt and PowerShell.
Rebooting the PC.
Re-installing Python (including removing old versions).
Both the python and python3 command.
Update 2 - NameError: name 'python' is not defined
Update on the update: This was a wild goose chase. You are not supposed to be able to use that command in the interpreter, as described in this post.
So I tried to use the console from the python.exe file instead, and I got the following answer. However, from what I can find on it, it's normally a problem you encounter on elements of the code (like print()) and not on the python command...?
(image removed)
Update 3 - It works (kinda)
If I use the command py --version or py test.py it works. I have no clue why though...
After extensive research, I still cannot find an answer to my own question. But I have found a work around, which minimizes the consequences:
Instead of using python, simply use py.
This will invoke the Python launcher instead of Python itself (from what I've read). For most people this will be good enough, but it is not the same. So it might cause issues and version mismatch in certain scenarios.
Also, despite of this weird behavior, Python seems to run fine in Visual Studio Code, when using the "Run" button (or the py command in the terminal).

How to run code with Hydrogen

I am completely new to Atom.
I installed it and it felt quite easy to use and set up. I read that the Hydrogen package enables functionality similar to the Jupyter Notebook. So I installed the package.
Unfortunately, I have no Idea how to use it. I read the entire documentation (which isnt too extensive) and searched for everything I could.
So here is my problem:
I created a file called testfile1.py
In that file i put the very simple line
print(‘Hello’)
just to see how it works. I marked the line and pressed Ctrl+Enter. At the top right, a window pops up saying “Hydrogen Kernels updated: Python 3”.
But then nothing happens. I dont see the result of the code that I tried to run anywhere. I tried different lines of codes, tried differen run-combinations, nothing gives me any results.
I am using arch linux, installed Anaconda through the AUR to /opt/anaconda.
Using the terminal and running
jupyter notebook
for example works just fine and opens a Notebook in Firefox (as it should) and running code that imports modules that came along with Anaconda also work fine once i run them with the script package in Atom
(things like
import numpy as np
is letting me work with all the numpy funtions as expected. So I think that it shouldnt be any issues related to the Anaconda packages itself)
I tried to look everywhere I could, but I do not find any solution on why hydrogen would not give me any results.
Is there anything I am missing or did wrong?
I hope someone might be able to help me, thanks already in advance
I'm using Windows 10, Atom version 1.30.0 with Hydrogen 2.6.0 (both with default settings).
If you navigate to Packages > Hydrogen you can see the default key bindings.
To make a cell there are many options noted in the manual as shown below.
I found I had to re-start Atom after updating the python kernel. Then the run code commands worked as expected.
You need to select all the lines which you want to execute with the cursor and then press ctrl+enter (or shift+enter depending on your keybinding).
There are two ways to tell Hydrogen which code in your file to run.
Selected code:
If you have code selected when you hit Run, Hydrogen will run exactly that code.
Current block:
With no code selected, Hydrogen will try to find the complete block that's on or before the current line.
If the line you're on is already a complete expression (like s = "abracadabra"), Hydrogen will run just that line.
If the line you're on is the start of a block like a for loop, Hydrogen will run the whole block.
If the line you're on is blank, Hydrogen will run the first block above that line.

Why isn't my PythonScript for Notepad++ running?

I'm running NPP 6.3.1 (UNICODE) and the current pythonscript plugin (python 2.7.6, pythonscript 0.9.2.0)
I recently got a new machine and had to reinstall both NPP and PythonScript (PS). I wrote a basic script a little while ago and had been using it a good bit and it worked fine using the PS plugin.
I installed everything and run the script through the PS plugin menu but nothing happens. I try it again and now, I keep getting the following error:
Another script is currently running. Running two scripts at the same time could produce unpredictable results, and therefore is disabled.
The script is designed to search the document and find the next available point number and insert it at the cursor. Like I said, it's a simple script that has a defined start and end. I've never had a problem with it before. So, I decided to create a new script (test.py) which consists entirely of the following:
console.write("test")
Nothing. The console doesn't show any activity no matter what I do, which leads me to believe that the script isn't even starting, even though it says that it loads up (in 16ms) and says its ready...
I tried uninstalling everything and reinstalling but still nothing. I haven't tried previous versions yet.
Am I missing something stupid?
The problem was that I did not have the most current version. After installing version 6.6.6 and PythonScript 1.0.2, it works.
Just want to leave this information for the next people who come in with this problem.

Issue with Python Batch file to run Python through Notepad++

EDIT: The code I wrote in my Python file was just this:
print "foo"
I'm using Windows XP Home Premium on this tiny little HP Mini 1000, and I want to run Python files, since we're learning it in school. I am aware of this topic, so I tried to run Python files using a batch file (python.bat), and I'm getting an error that says, "Can't find 'main' module in ''" whenever I run the batch file. I followed the instructions given here. All I did was change "Python26" to "Python33" because of the difference in versions.
Any idea what's wrong here? I really want to run Python files from Notepad++, so I don't want any alternative ways to run them.
This sounds like you don't have PYTHONPATH set up correctly. I suggest you review the documentation here:
http://docs.python.org/2/using/windows.html
Instead of calling Python, call cmd.exe and then use the set command to inspect which variables are set and how they are set. Run the exit command to leave the command shell. When you think you have the variables set up correctly, try again to run Python.
Good luck and have fun!
I use the command line interpreter or IDLE mostly (Win 8.1 now, but I've done so since Win XP SP2), but NPP is my main text editor, so I was curious about this issue.
When I was reproducing this, I was able to generate several errors, but the only one I got that was an exact match was when I failed to configure the Run option correctly.
You need to make sure to follow this step exactly in the instructions you were following. When you navigate to Run -> Run in Notepad++, you have to enter this exactly:
C:\Python33\python.bat "$(FULL_CURRENT_PATH)"
I am pretty sure you left out the "$(FULL_CURRENT_PATH)", or otherwise didn't add it correctly, as failing to do so causes exactly the same error on my end. Failing to include this means that when you run the batch script, you get the wrong input to the Python interpreter, causing the error.

Categories