Why does PyCharm return exit code 246? - python

I am running a script in PyCharm and using the Python 3 installation that is installed with ArcGIS Pro.
Every other time I run the code, it returns "exit code 246", but it is not clear to me what could be causing this.
If I close and reopen the program or restart my computer, I might be able to run the code, but it doesn't work consistently.
The issue doesn't happen consistently so I don't think it's an issue with the code itself.

I discovered the same problem. Problem went away when I did this
try:
import arcpy
except:

Related

Spyder kernal hangs on running scripts that used to work

Noticed this problem earlier this week: when I try running anything in Spyder, the script will usually execute fine the first time I run it, but if I try to run it again, the kernel hangs indefinitely after printing the standard "runfile('C:/Users..." statement. Ctrl-c doesn't work as an interrupt; the only fix I've found is to restart the kernel, then run some simple command such as a variable declaration (e.g. trying to run the script, restarting the kernel, then immediately retrying the script causes the restarted kernel to hang, but trying to run the script, restarting the kernel, running a simple command like x = 1, THEN retrying the script works - once). It seems like it might be an issue with my local directory, because anything in Spyder's default temp script runs fine. If I save the same script to a local directory, though, the problem persists, even for a one-line print("hello world") program. The problem is occurring with scripts that ran fine as of a week ago, and as far as I know I haven't updated Spyder or Windows in the interim. Has anybody run into anything like this before?

VS Code had a problem in running the code

I tried to run a python program in VS Code. But my program didn't run. The terminal opened and a weird arrow was there in the terminal. This is the screenshot of that.
This is the weird arrow and the program is not running. Any ideas why this is happening and how to fix it?
Thanks in advance.
Firstly, the arrows are included in the default python IDE means that VScode ran the command to execute your code. Give your pc a restart. Now, let us check if python is working or not or VS code is having some trouble. Type the following command in cmd to execute the code-
python "$PATH"
Rember to replace $PATH to the path of the file i.e where your file is stored. For eg. I've my python files stored in D drive in a python folder, so I'll use-
python "D:\Python\Hello.py"
If this works, python is working fine and if not, try reinstalling python and check the box which says Add python to Path or Environment variables. Then open VS code try to run the program again. But click the button only once and be patient because clicking it multiple times causes execute the same command again and cause a problem. It's my personal experience. Wait 5 minutes. Not works. Don't worry, there's a problem with the run extension you are using. I'll recommend the Code runner by Jun han. I personally use it. Type this in the extension search box-
formulahendry.code-runner
Install it and then try again.
Kill the terminal, and retry. If not work, restart the VSCode.

Python, Rodeo gives "Unable to execute" error

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

Windows executeable created with Py2exe won't run on another computer

I created an executeable of my Python script. Everything works just fine on my first computer but when I try to run this very same executeable in another computer, it wont work. When I try to run my executeable I see that computer tries to open it, because command prompt window appears but nothing else happens, prompt window will disappear. Problem can't be in computer, because both my computers are 32 bit Windows machines and I have done similar things before but this kind of error I see first time.
I don't want to post my code at first, because it is more than 500 lines long. But I will give some more specifications about my problem.
This program I create is actually advanced version of application i made earlier. And earlier version worked fine in both of my computers. This advanced version, I am working on now, is developed into many standalone Python scripts unlike first one which was only one script. Could this be the source of my problem? Should I do something different when running setup.py now when I have many scripts?
And then there is third version of my application. Executeable of it runs fine on computer where I created it, but in my second computer it wont run either. But this time I get error too. When I run this program in my second computer the opening screen of aplication appears, there are some buttons which are meant to open other scripts, when they are clicked on. But when I click them I get following error: The system cannot find the path specified.
If someone is willing to look into my long code, then I am willing to share it. But again I dont want to post it here.
I am using Python 2.7 and windows 7 in my first computer and windows XP on my second computer.
I would be very grateful if someone points me right direction which helps me to solve my problem.

"executable not specified" error when running python script

I moved a script I was working on to another computer with the same version of python. When I try running the script on the second computer, I get an error that reads
error running myscript: Executable is not specified
Tried looking it up, didnt' seem to find anything.
Is it possible this is because I installed python alone on the first computer, but anaconda on the second? I'm not really sure what could cause the error. As far as I can tell it has nothing to do with the code. Tested on the original computer and worked fine.
Ended up just creating an executable through py2exe rather than trying to figure out what was going on with the paths. Works perfectly.

Categories