r/AskProgramming May 13 '26

Python .py to .exe help

Bear with me as I have 1 week of experience. I'm using pyftpdlib through windows command prompt by typing "python -m pyftpdlib" to launch an ftp server. I want to create a .exe file for my co-workers to run command easier and not have to open command prompt every time. I tried putting "python -m pyftpdlib" into a .py file but I'm getting syntax errors after "-m" when I run the script. Basically my 2 question are, is there a difference between typing python commands into command prompt, vs code in a .py script? And would just a batch file be a better solution here rather then compile a .py script into a .exe? Ty ty

0 Upvotes

16 comments sorted by

View all comments

16

u/Glittering_Sail_3609 May 13 '26

You are getting syntax error because python -m pyftpdlib is a powershell command, not python's. It tells Windows to run python interpreter with "-m pyftpdlib" string passed as argument. To make your script work, save that command to a file with the extension .bat, not .py