I'm trying to run the following from terminal on my mac, but what's happening is
the code appears to run (I don't get any error message), python (as an app) on my mac bounces on my dock as if to open and then it doesn't do anything and then it stops running. I can't tell if this is a permissions issue or a Mac Catalina issue or an issue with my code!
import pyautogui as gui
count= 0
gui.click(1080,521)
while count<5:
gui.FAILSAFE=True
gui.write(f'This is a test {count}x')
count += 1
gui.press('enter')
I've already tried to run the sudo command, I've also tried:
gui.moveTo(1080,521)
gui.dragTo(button='left')
in place of the gui.click command, but nothing seems to be working!
Help?
Turns out this was a permissions issue - in Mac System Preferences I needed to give access to Terminal to control my mouse
In my case with Big Sir System Env I did
setting -> security & privacy -> Accessibility -> Terminal 'check'
It works well now.
Related
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.
I have been searching for answers to why my mac mini running OS High Sierra keeps throwing this error:
objc[18808]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork()...
I currently have 15 scripts that are essentially the same, just for a different ID and running through cron. This issue seems to stem from running this mac OS version along with multiprocessing in python. I've found several threads saying to use
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
So this works oddly ONLY if I enter it in to the console. So to make it work I have to: ssh into my mac mini, enter in the export line above, and then run the scripts. When I try to let Cron handle it, I'm still seeing that error pop up in the logs. I've added that export line to my ~/.bash_profile, entered it in and even checked my env - all of which say that is present in my environment. Yet I'm getting this error no matter how I try to run the scripts right now.
I have tried adding this to my scripts:
os.environ["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES"
but this has not helped. It also doesn't work if I do not enter in that export line manually - I am guessing somehow that line is not being applied to the right environment?
Any help would be greatly appreciated!
Figured it out! So started searching on how to set the environmental variables for cron and you can do so just by simply editing with crontab -e and then adding the line:
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
Every single time I open Pycharm I get the "no Pyhon interpreter configured for the project", so I go to Settings -> Interpreter and choose it from the list. But as soon as I close Pycharm and open it again next time, I receive the same message. I went crazy on trying to google for the answer, is there anyway to solve this? I've had Pycharm for a long time and never had this kind of an issue. Fresh install on win 8.1.
You should set the default interpreter for PyCharm, For that, go to :
File > Preferences for New Projects > Project Interpreter
I've installed Canopy and completed the environment setup. Unfortunately, nothing I input into the code editor gets printed onto the Python interpreter pane (e.g. I input print "hello world" and hit enter but nothing happens. Also, the Run > Run File command is grayed out. My directory is set at "Keep directory synced to Editor".
What's gone wrong?
I met the same problem. I solved the problem by creating an account, requesting an academic license (as a student) and logging in on the welcome screen with my account. I am not sure whether the second step (requesting a license) is necessary but you can try. See the pic below. Run and Debugging buttons are active after signing in.
I had the same problem. I.e., I could not run any code or see anything in the Python Pane. Try restarting the kernel. That worked for me.
Run -> Restart kernel...
or Ctrl + .
Launching Python has encounterd a problem. Unable to get project for the run
It would let me put the word problem in the title.
The title is the exact message i get when i try to run/debug a file in Aptana 3.
I have always been able to run Python in Eclipse without problems. Does anyone know what causes this error?
For testing purposes i just created a new Pydev project with only 1 file in it.
I had the same problem with Aptana and just solved it. In my case I had configured another interpreter (IronPython) for running another script. When I got back to a previous script I got the same error message as you "Unable to get project for the run" because it was trying to run it with IronPython instead of Python.
I would therefore recommand the following:
1) Check your interpreter configuration.
-> Window -> Preferences -> Pydev -> Interpreter Python
If you have no interpreter there try autoconfig. If it doesn't work you will have to browse it yourself by clicking New (then it should be somewhere like C:\Python27\python.exe)
2) If you have an interpreter, it means that Aptana is trying to run your script with another interpreter. In that case right click on your script file in Aptana -> Run as -> Python run.
That worked for me.
Good luck !
Go to Run -> Run configurations -> Python run
delete "New configuration"
then it must work
It occurs when you create a New configuration for run a program.
go to Run > run configuration > python run
select "New configuration"
press on delete icon
and again Run the program .
this is worked for me .
I had similar issue. Below action solved my problem.
Go to Run > run configuration > python run
Delete all the configurations below python run - it may not be a great option if you have any custom configuration settings.