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.
Related
I'm lost with Python. After troubleshooting with a friend through Discord for literally months I am about to give up. This is my last attempt at trying to get Python fixed on my Windows 10 laptop.
I'm using a Lenovo Legion 5, bought the laptop in November 2020. I've not been able to get anything related to Python to run in the CMD window. I can run Python no problem, but nothing I have installed through pip has ever worked. I can use virtualenvs, but only through PyCharm for example. Python has never really worked through the command line.
Yes I tried reopening the CMD window, rebooted the system many times, ran the CMD as administrator, installed the path variables for both Python and esptool.py but nothing seems to help.
I honestly don't know where to start because none of the 250+ websites I've visited to so far that suggested a fix for any kind of issue I've been experiencing with Python has been working. I can run Python fine by the way, just none of the things installed through pip will work.
Let's start with a use-case:
I'm trying to run esptool.py so installed it with pip install esptool. This install worked fine, and I can confirm it is installed with pip show -f esptool.
However, when running esptool.py version it told me:
'esptool.py' is not recognized as an internal or external command, operable program or batch file.
So I added the local folder from the previous step to the %PATH% variables, after running esptool.py version it gave me a popup asking me with what kind of program I should open this, I didn't select to open with this kind of program from now on. This makes it so that I do not get an error, what now happens is that another window quickly opens and then exits without an error code. So I have no clue what's happening.
What should happen is that it should tell me which version is installed in the CMD window.
There have been a few other things going on with my Windows 10 install, for one, the username that I used during the installation wasn't used to create the user directory. Windows 10 somehow instead chose a name that was related to the first 5 characters of my email address, which is totally strange as I haven't used that string in the installation of Windows 10 at all. This was a fresh install on a new laptop.
Now, after an update of Win10 my user icon doesn't display anymore and I had to change ownership of the 'Windows Apps' folder in order to be able to access it. Changing the ownership also changed the name I now see on the login screen when I boot up the laptop. It changed from the 5 first chars of my email address to my full name in the login screen, only because I took ownership of this folder so I could access it.
There have been a lot of things going on that I think should not be changing all the time, things to do with administrator rights, ownership, etc.
Now, since opening esptool.py doesn't open it, but also doesn't show me an error, I'm clueless and the only thing I can think of is doing a fresh system install, but I have a bunch of projects going on for which I need this laptop in working order and I don't have the mental health (due to corona) left to do a fresh system install. I'm worn down. Not in a dramatic way, I just don't have the spare energy to go through the whole process. So I'm hoping someone can point me in the right way to troubleshoot why my Python doesn't want to work natively.
What happens when running esptool.py version is that I can see it opens a Python window, but without showing any content it closes within a few milliseconds.
What is going on, how do I continue? I hope someone knows how to troubleshoot my system, to find the core of the problem.
It apparently was rather simple. First of all, thanks for the replies! And second of all, thanks for pointing me to superuser.com I wasn't aware of the site and will continue there.
The fix was to use python -m pip install esptool as suggested by Valentin Kuhn.
To answer AKD, I have a lot of experience with programming on my MacBook, but I'm not experienced with actually maintaining the system side, I'm a creative user. It's just that ever since I got a Windows laptop it's been nothing but trouble and after months of chatting about each individual issue with people on Discord nobody has been able to find a solution. I'm not expecting a GUI, just a simple "esptool.py v3.0" was the answer I was expecting from the command line.
Now what I don't understand is that I've never found any hint to anyone suggesting python -m. I will get on superuser to find out more about why the standard instructions that work for most people, don't work for me.
Sorry for using the wrong site for my question, I came on here through another related question and it was past my bedtime and I wasn't thinking clear.
I created a python script to control the RGB of my keyboard and my mouse and i want it to start when i turn my computer on. I have 2 solutions but i don't know which is the best.
the first solution is to build my script and run the executable on startup
the second solution is to run directly the python script with python.
the first solution is a little bit annoying because is i want to change the code, i need to rebuild my script. and also when i tried to run the exe (created with pyinstaller), it didn't work (because of the dlls i think)
the second solution is better if i want to change the code later, but i don't know how it would react if i run another python script (i don't even know if it's possible to run 2 python instances at the same time.)
so if you have any idea on which solution to choose, how to build a script using dlls with pyinstaller or if i can run multiple python instances (maybe i can run multiple venvs), feel free th help me.
PS: I tried to be clear but as i didn't speak english very well i don't know if you understood my issue.
Using windows : https://www.geeksforgeeks.org/autorun-a-python-script-on-windows-startup/
Using Linux : follow this https://stackoverflow.com/questions/24518522/run-python-script-at-startup-in-ubuntu#:~:text=Put%20the%20command%20python%20startuptest,and%20put%20the%20command%20there
I am trying to run a python script via cmd prompt on my work PC (Windows 7, Python 2.7). The script requires filepaths from different drives on my PC. I am correctly pulling all necessary filepaths and I press Enter to run the script but the script just hangs. The only thing that shows is a blinking underscore. I try to click the X to close the prompt but nothing happens.
I am not able to Ctrl+C out of the program either. I open up Task Manager and I am not able to End Task (nothing happens) or End Process (cmd.exe doesn't even show up in this tab). I also tried Start-->Run-->taskkill /im cmd.exe but nothing happens. The rest of my team has no problem with Python 2.7. The only way to get out of the frozen cmd is to hold down the power button. I do not want to have to keep going through this process especially since this is during work. I'm hoping someone will be able to help me out:
Any idea what's wrong with the version of Python I am using?
How am I able to kill cmd.exe so that I can continue normal work functions without having to hold down the power button and waiting 5-10 minutes to reboot my PC?
The filepaths I was pulling files from were through ClearCase directories. It turned out that I simply had to reinstall ClearCase. There must have been some configuration issue that was causing the cmd to hang and thus forcing a hard reboot. It's good to point out that I am no longer experiencing this problem and that nothing was wrong with the python scripts.
I am a security student first starting out with Python. I've built my first program for my class and it is meant to be an exe so that it may run on any computer without having me install python onto it. The program is meant to go unnoticed by the user, but whenever it is executed a command windows pops up.
Does anyone know how to make a .py into a .exe that when launched would not bring up the command prompt?
I have already tried compiling a .pyw into a .exe and it still pops up the command prompt.
Googling around the py2exe web site, you need to say setup(windows=['myapp.pyw']) instead of setup(console=['myapp.py']). I have problems finding out which page is saying that exactly, but hints are given here for example (search for "console"):
http://www.py2exe.org/index.cgi/FAQ
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.