I have a program in my pycharm with all the required packages installed.
I want to run windows task scheduler to run this program.
The problem is when task scheduler runs the program, it doesn't seem to run the script from pycharm but runs it from IDLE (I'm assuming so). the IDLE gives out error for "modules not found".
Can any kind soul please advise:
how to configure my pycharm code (with all its installed packages) to be the same in the IDLE; or
how to run the task scheduler directly from pycharm instead; or
how to install all the packages in IDLE.
The putting the shebang at the start of your script:
#! python3
...
Related
On a Windows machine, where I have no admin rights, I've created a python script which loads a module that is only available in Spyder development environment. To run it, I have to open Spyder, select the script and the working directory, before actually running the program.
I'd like to automate those steps. The ideal way would be to run the script from a console (in the correct directory), loading the python modules available in spyder.
Something like:
spyder.exe myPythonScript.py
Any idea about how to do it?
I am trying to run the following simple python script called 'main.py', through a pipenv virtualenv:
print("started.")
Executing pipenv run ./main.py --verbose (in pipenv venv) does not print anything to the console.
Through VS code, running pipenv run ./main.py --verbose outputs the following:
That is to say, the python file seemingly does not run, expected 'started.' to be printed to the console, recieved nothing printed and program terminating.
This behaviour is also present when I attempt to run it through cmd, note the error produced with the --verbose flag:
I can run it sucessfully through just using python, however I really want to use pipenv to manage packages ect. I guess I'm mostly just curious at to:
Why does this error occur?
What does the following error, caused by running it with --verbose flag, mean?
[5772:0107/202720.999:ERROR:broker_win.cc(56)] Error reading broker pipe: The pipe has been ended. (0x6D)
How do I fix the issue?
I have reinstalled Pyhton, pipenv, and vscode - but have recieved the same results. Running the 'pipenv run' command both within the shell and outside the shell have the same results.
EDIT:
A Visual Studio Code issue
In the post above, after runing pipenv run main.py, vscode would always open. Whats stranger is, once vscode is uninstalled, the command works as expected! So an additional question of mine is,
Why does vscode make this issue happen/what's the fix for being able to code using vscode and running pipenv run?
see bellow for what occurs when running pipenv run main.py with vscode initally closed:
This screenshot is after ~5mins of no action in iether the vscode console or the cmd console. The program never exited, and closeing the cmd also closed vscode.
pipenv run main.py means open the file in the ide you chose in the pipenv environment.
In this way, it just opened the file instead of run python file.
You need to use command python main.py to run it.
I'm making a Tetris clone that runs in terminal and I'm using the Pynput Keyboard Listener to listen for user input. Everything works fine when I run it in Pycharm (be it by pressing the "run" button or when I launch it with $ python3 main.py from Pycharm's built-in terminal. However, when I open a "standalone" terminal and launch the program inside it, the Listener doesn't do anything, even though it seems to be running when I run for thread in threading.enumerate(): print(thread.name) in the script (same output in both terminals).
Pycharm is using the default Python interpreter (/usr/bin/python3.8). Running pip list returns the same information when run in both terminals. Running the program as root doesn't change the behaviour in either terminal. Neither does running it with the absolute path of the interpreter, $ /usr/bin/python3.8 main.py.
I have tried $ pip install --force-reinstall pynput along with updating pynput, but nothing has worked.
I am running KDE Plasma (Ubuntu LTS) and using Python 3.8.10.
EDIT: I have tried running the program on a Windows machine and it worked fine both in Pycharm and in PowerShell.
I've been struggling for a long time now to get this running but I just couldn't do it. I am runnning PyCharm Professional on Win10 and I want to code and run Shell scripts, but I cannot get it to work. There is this Shell Plugin from Pycharm but there is just not enough documention for me to understand how it has to be setup.
How do I have to setup PyCharm in order to Run/Debug Shell scripts?
I tried changing the shell used by the Terminal to the WSL Ubuntu shell, which actually worked. Thus I can now manually execute the bash script via the terminal.
I also tried changing the Run/Debug configuration.
changed Run/Debug configuration
as suggesteed, changing the interpreter to bash.exe led to an error message.
interpreter changed to bash.exe
I tried bash.exe, ubuntu.exe and cmd.exe as shells for terminal, all of which threw a file not found error. As before executing it manually with the wsl path format(/mnt/c/..) works. manual execution
"file not found"-error
So I guess it was my misunderstanding in the end, that you can't really work with shell scripts like you do with python. meaning debugging etc and watching variables. I am trying to reduce my file shuffling code in bash anyways and try to stay mainly in python so there is now another motivation for that. thank you very much for helping me though.
How can i run a python script at startup with xubuntu 15.04?
I want to run a script that reminds me of things,like backup,buying thing,calling somebody.
I already have the script,i just need it to start at startup.
(Python 3.4)
As far i know, xubuntu 15.04 uses systemd.
All the tutorials i found,are for init.d or upstart.
I need one for systemd
Found the answer.
You have to go Configuration/Systemsettings/Session and Startup,
and add the program.