Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: Aladin on April 01, 2020, 08:55:08 AM

Title: Convert .py to .exe and install in sd card
Post by: Aladin on April 01, 2020, 08:55:08 AM
I want to convert .py file to .exe and install it in the sd card and run it
Can someone help me
Title: Re: Convert .py to .exe and install in sd card
Post by: Greg Erskine on April 01, 2020, 01:33:17 PM
You don't usually have .exe files in Linux.
Title: Re: Convert .py to .exe and install in sd card
Post by: Aladin on April 02, 2020, 07:45:01 AM
How can you make a Python script executable on Unix?
 Put #!  / Usr / bin / env python in the first line of your .py script.

 Add execute permissions to the file (using chmod).

 Run the script from the command line, for example.  by providing ./my_script.py in the same directory.

Is this ok ?
Title: Re: Convert .py to .exe and install in sd card
Post by: Rich on April 02, 2020, 08:01:40 AM
Hi Aladin
How can you make a Python script executable on Unix? ...
How you ask your question is important. Your initial questions sounded like you were trying to mix Linux and Windows programs.

Place this as the first line in your script:
Code: [Select]
#!/usr/bin/env python
Set file permissions:
Code: [Select]
chmod 775 MyScript.py
Execute script:
Code: [Select]
./MyScript.py
Title: Re: Convert .py to .exe and install in sd card
Post by: Juanito on April 02, 2020, 08:11:39 AM
You may need /usr/bin/env python3 if using the python3.6 extension.