Could someone explain to me how can I run my py2exe program, a console program, without the terminal on Windows?
I'm trying to make a program that re-sizes windows and it supposed to start with windows, so I want it hide out but still running...
Use the setup() function like this:
setup(windows=['myfile.py'])
See the list of options for setup().
Not really understand your requirement, but you can try start /MIN. type start /? on the command line to see its help page.
Would you consider compiling it into an EXE (using py2exe or some such) and adding it to your list of startup programs?
Sounds like what you want is for your script to run as a Windows Service instead of a Windows program. Something like this tutorial might be helpful:
http://islascruz.org/html/index.php?gadget=StaticPage&action=Page&id=6
Related
I created a script which just asks a user for their name and age using Python's input() function.
I installed the package Script. This ran the script well but couldn’t deal with the input.
I have also tried a number of other options but haven’t had any success.
Any ideas how to build and execute scripts from within Atom? I don’t mind if it just simply saved the script and opened Pythons IDLE at a minimum.
Add Terminal-Plus and run the code with the python name_file.py command
Script Runner can run scripts and supports input, unlike Script. It's the simplest full terminal package that I know of. To run a script, press Alt+X
For more advanced usage, you might look at Hydrogen.
The atom-python-run package gets around the input("") freeze problem by opening a terminal window and running the code in that.
Doing it within Atom has eluded me too, but this works OK.
To get notifications is that must to keep the pycharm online?
Everything work fine and pushing notifications but when i close the pycharm then the notification stops and not working!
Your question isn't exactly clear to me. What notifications? From your python script? I guess so, then you should run this script from command line instead of running it inside PyCharm. Open cmd in your working directory, where your program is and run it using 'python myscript.py'. I believe that should help (obviously now you need to keep your terminal open), but please try to phrase your questions in clearer way.
Is that possible to run multiple codes in multiple terminals at a time?
If by 'codes' you mean python scripts, then the answer is yes. Each terminal instance can run an independent application, script, whatever you want basically. So in your case you could open multiple terminals and run multiple scripts.
Usually, when I run a python program, I need to open a terminal and type things like
python program.py
But I want to run this python program without a terminal (or some window like that) running on Windows. But it will be running anyhow, just like Google Drive is always running on my PC without any windows being popped up. Is this possible? (I am making this program to run as soon as the Windows is booted up.)
If on Linux, try:
python program.py &
On windows there is an exe called sc.exe that would make services to run in the background.
Syntax looks like this:
sc [servername] create MYService binpath="c:\anaconda\bin\python.exe c:\scripts\myprog.py" start=auto
although I'm not sure if you have to put the binpath in quotes or just put that whole thing in a bat file and run that.
This is a really short question. I have created a package for Mac using Pyinstaller and I am mainly trying to add an icon to it. I am also trying to get the program to run without launching the terminal as the user has no interaction with the terminal. Currently I am keeing the following into cmd when running pyinstaller:
python pyinstaller.py --icon=group.ico --onefile --noconsole GESL_timetabler.py
I get the regular package (Unix Executable) and an App. However only the Unix Executable works and the no processes run when I double click the App.
Also, neither the App, nor the Unix Executable, has the icon image displayed. I am sure this is a trivial problem with my command to pyinstaller, but I am having difficulty figuring out the mistake. Could someone help me fix the instructions above? Thank you!
You must have group.icns file for app in Mac OS
Try using --windowed instead. As far as I can tell they're the same thing, but it might do the trick.
As for icons, I've only gotten that to work on console windows. It just doesn't carry over to my main GUI window.
I am trying to use Curses in PyDev in Eclipse in Win7.
I have installed Python 3.2 (64bit) and curses-2.2.win-amd64-py3.2. When I input the following testing codes into PyDev:
import curses
myscreen = curses.initscr()
myscreen.border(0)
myscreen.addstr(12, 25, "Python curses in action!")
myscreen.refresh()
myscreen.getch()
curses.endwin()
It did not show any syntax error, so I think the curses was installed correctly.
However, when I ran it as Python Run, the output showed: Redirection is not supported. I do not know where this problem comes from. I googled a lot but can't find related information.
Recent PyCharm versions (I am currently running 2017.2, not sure when this option was added, or if it has been there the entire time) have the option "Emulate terminal in output console". Curses works with this option checked.
You cannot expect to use curses with a non-terminal.
Probably you get this because you are running the script from inside an IDE, like PyCharm or any other.
All IDEs do provide consoles that are not terminals, so that's where the problem comes from.
For a Pycharm user the solution given by codeape works fine :
Snapshot
You can't use any IDE to run python files with the curses package. I used to run in pycharm and naturally couldn't run.
Change to the command line to run:
for testing follow my following steps
on desktop open notepad and copy paste the code and save it as filename.py
open command line change directory to desktop use below command cd Desktop and hit enter type python example.py and hit enter, your program will definitely run
My workaround is to create a Run Configuration that calls a curses script. The little overhead is worth not having to switch to the terminal and manually run the script hundreds of times a session. I use Intellij but I imagine the process should be similar in PyCharm.
The desired result is the convenience of a button to run the script:
First create a script that calls the entry script, for instance:
ptyhon name-of-script.py
Then, to create a configuration for each script:
Go to Edit configuration.
Click the plus button and add a Shell Script.
Enter the path to a shell script.
Here is a picture of a directory with a couple of sample scripts.
I use this process to view my progress. My curses scripts are very modest so fortunately I can live without a debugger.