Run Python script when I log into my system? [xubuntu 15.04] - python

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.

Related

Running Python script on windows task scheduler

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
...

Starting a python script at boot - Raspbian

I have a python script. This script is essentially my own desktop/UI. However, I would like to replace the default Raspbian (Raspberry Pi linux distro) desktop enviroment with my own version. How would I go about:
Disabling the default desktop and
Launching my python script (fullscreen) at startup?
This is on the Raspberry Pi running a modified version of debian linux.
(Edit: I tried making a startup script in the /etc/init.d directory, and added it to chmod, but I still can't seem to get it to start up. The script contained the normal .sh stuff, but also contained the python command that opened the script in my designated directory.)
Ah bah, let's just give a quick answer.
After creating a script in /etc/init.d, you need to add a soft-link to the directory /etc/rc2.d, such as sudo ln -s /etc/init.d/<your script> /etc/rc2.d/S99<your script>. Assuming, of course, that you run runlevel 2. You can check that with the command runlevel.
The S means the script is 'started', the number determines the order in which processes are started.
You will also want to remove the entry from rc2.d that starts the graphical environment. What command that is depends on how your pi is configured.

Run Python Script with Bash modules in Windows

I have a Python script and I'm trying to run it from Windows or some online Python interpreter. I would like my friend to test it but he doesn't have linux.
The conflict here is that I have modules such as "import os" in the script that is only native to the bash environment. So how can I get my friend to run my .py script in Windows?
Thanks!
The cool thing about python is that you friend should be able to run your script with little to no change(hopefully), to quote the python os docs
This module provides a portable way of using operating system
dependent functionality.
If your friend did have an issue you might have a another question to ask.

Getting Enthought Python IDLE to run code when shell is restarted

I'm running EPD and using IDLE for most of my coding. What I'd like to do is get IDLE to run a script to customize my environment whenever I restart the Python shell. I've tried reading all the various posts on customizing IDLE and the Python environment, and I've yet to see anything that addresses this specific scenario. Does IDLE or EPD IDLE (if there's any difference) have a particular module it's looking for when it restarts the shell, like usercustomize.py or sitecustomize.py? Has anyone accomplished this on their own? Any guidance is appreciated.
Upon startup with the -s option, IDLE will execute the file referenced by the environment variables IDLESTARTUP or PYTHONSTARTUP.
Check out: http://docs.python.org/library/idle.html#startup
Cheers,
Johannes

How can I run a python script on windows?

Can anyone please tell me an IDE for running python programs? Is it possible to run the program through command line?
Take a look at ActiveState's ActivePython. It's quite a nice implementation of Python on Windows. Another way is using Cygwin's Python port. These two are Python implementations. I don't use an IDE, I write my Python code in Notepad++.
To run a python program after saving it to C:\Users\vaibhav\Code\myscript.py:
ActivePython: If I remember right, ActiveState updates the path correctly. So it should be a s simple as:
Press "start" in the task bar
In the search field search for "cmd"
In the appearing box navigate to your folder with the python script: dir Users\vaibhav\Code
call python myscript.py and you're done
Cygwin: After installing Cygwin, you have a full-featured bash terminal on your Windows machine.
click on the Cygwin icon on your desktop
In the appearing window navigate to the folder with your python script: cd /cygdrive/c/Users/vaibhav/Code
type python myscript.py
e voila
IDE for running scripts? You can have any IDE you like, but if you need only to run python scripts you go like this:
python.exe pythonScript.py
I like the EasyEclipse for python distribution. You'd need to have python and java installed of course.
PyDev and Komodo Edit are 2 nice Python IDE on Windows.
I also like the SciTE text editor very much.
These 3 solutions make possible to run Python scripts
I tried to run a Python script with multiprocessing on windows. see this tutorial
It does not work on Windows, but on raspian it went very well. Thus I knew that it was a Windows problem. I installed cygwin and followed this tutorial Installing Python inside Cygwin.
After that I additionally installed numpy with the command easy_install numpy and now i can run python scripts with multiprocessing on windows (from cygwin).

Categories