Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

Python how to share my Python program with friend?, without let them see the codes inside?

views
     
TSadam_lew85
post Apr 26 2023, 10:54 AM, updated 3y ago

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
Hi guys, recently i just started to learn Python and successfully created a simple little program. Now i would like to deploy and share this little program with my friends to let them play with it, but i don't want to let them see the codes i writing inside the program. Is there any simple way to accomplish this?

I am still a beginner of Python programming, i have tried to use Flask and Pyscript to deploy my program but none of these methods work for me and these methods are quite complicated for a beginner like me.

Thanks for any help from sifus here. notworthy.gif
LostAndFound
post Apr 26 2023, 10:57 AM

Look at all my stars!!
*******
Senior Member
6,270 posts

Joined: Jul 2005
From: UEP Subang Jaya



QUOTE(adam_lew85 @ Apr 26 2023, 10:54 AM)
Hi guys, recently i just started to learn Python and successfully created a simple little program. Now i would like to deploy and share this little program with my friends to let them play with it, but i don't want to let them see the codes i writing inside the program. Is there any simple way to accomplish this?

I am still a beginner of Python programming, i have tried to use Flask and Pyscript to deploy my program but none of these methods work for me and these methods are quite complicated for a beginner like me.

Thanks for any help from sifus here.  notworthy.gif
*
The term you are looking to google is obfuscation.

If you're using python, generally the expectation is that your code is openly readable. You can package it to an exe which most 'normal' users can only read, but that's not fool proof (depending on who your friends are this is probably good enough).
junyian
post Apr 26 2023, 11:03 AM

Casual
***
Junior Member
401 posts

Joined: Jan 2003


Your little python program is web based? Since you mentioned Flask and Pyscript.
Another rather popular option is Pyarmor.
soul78
post Apr 26 2023, 11:08 AM

Enthusiast
*****
Junior Member
944 posts

Joined: Jul 2005


maybe can try compile to .exe via pyinstaller
TSadam_lew85
post Apr 26 2023, 03:20 PM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(LostAndFound @ Apr 26 2023, 10:57 AM)
The term you are looking to google is obfuscation.

If you're using python, generally the expectation is that your code is openly readable. You can package it to an exe which most 'normal' users can only read, but that's not fool proof (depending on who your friends are this is probably good enough).
*
QUOTE(junyian @ Apr 26 2023, 11:03 AM)
Your little python program is web based? Since you mentioned Flask and Pyscript.
Another rather popular option is Pyarmor.
*
QUOTE(soul78 @ Apr 26 2023, 11:08 AM)
maybe can try compile to .exe via pyinstaller
*
obfuscation process seems complicated, what i want is just to hide those codes i put inside the program

currently my python program only can work in terminal and repit, i am thinking how to share the program with my friends for them to play with it? maybe make it into web-based is the best option? hmm.gif

if use the pyinstaller to make it into exe, can it be opened in our smartphone directly?
TSadam_lew85
post Apr 26 2023, 03:59 PM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(soul78 @ Apr 26 2023, 11:08 AM)
maybe can try compile to .exe via pyinstaller
*
is it safe to open exe file in our smartphone? I worry peoples won't open exe file if i send it to them
Tullamarine
post Apr 26 2023, 07:00 PM

Getting Started
**
Validating
163 posts

Joined: Apr 2020
QUOTE(adam_lew85 @ Apr 26 2023, 03:59 PM)
is it safe to open exe file in our smartphone? I worry peoples won't open exe file if i send it to them
*
EXE is not intended for smartphone although you can use emulator...... bruce.gif
15cm
post Apr 26 2023, 08:27 PM

Casual
***
Junior Member
423 posts

Joined: Apr 2022
create a cmd file

hide your script in many layers of folder


then in the cmd file put , cd <directory> , then python <your script name>.py <whatever variables>

looool

This post has been edited by 15cm: Apr 26 2023, 08:29 PM
TruboXL
post Apr 26 2023, 08:30 PM

Keep on keeping on! 👍
******
Senior Member
1,050 posts

Joined: Jan 2016
From: Land of floods, Kota Tinggi


You can compile to .pyc file. Look up Python bytecode.
TSadam_lew85
post Apr 26 2023, 09:48 PM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(15cm @ Apr 26 2023, 08:27 PM)
create a cmd file

hide your script in many layers of folder
then in the cmd file put , cd <directory> , then python <your script name>.py <whatever variables>

looool
*
I am writing my code in Notepad and save as .py file. How to hide the code in layers of folder?

Can teach me how to create a cmd file?

As long as they can open my program on their smartphone then is OK ady.
TSadam_lew85
post Apr 26 2023, 09:49 PM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(TruboXL @ Apr 26 2023, 08:30 PM)
You can compile to .pyc file. Look up Python bytecode.
*
Nice, another method rite? Will Google tis later, thanks for sharing ya
TSadam_lew85
post Apr 26 2023, 09:52 PM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(TruboXL @ Apr 26 2023, 08:30 PM)
You can compile to .pyc file. Look up Python bytecode.
*
Can this pyc file run on smartphone? My priority is to let the end user easily run my program on their smartphone
15cm
post Apr 26 2023, 10:09 PM

Casual
***
Junior Member
423 posts

Joined: Apr 2022
QUOTE(adam_lew85 @ Apr 26 2023, 09:48 PM)
I am writing my code in Notepad and save as .py file. How to hide the code in layers of folder?

Can teach me how to create a cmd file?

As long as they can open my program on their smartphone then is OK ady.
*
its a joke loool

wait you want to convert your python script into smartphone app?
TSadam_lew85
post Apr 26 2023, 11:47 PM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(15cm @ Apr 26 2023, 10:09 PM)
its a joke loool

wait you want to convert your python script into smartphone app?
*
ya can we convert the script into smartphone app?

or any other simple way to share my program with others and let them play it directly on their smartphone
Tullamarine
post Apr 27 2023, 02:05 AM

Getting Started
**
Validating
163 posts

Joined: Apr 2020
Use Oxyry (https://pyob.oxyry.com/)?

You can then paste it on Online Python Compiler and share the link with your friends. It can work in web browser on phone or PC.




TSadam_lew85
post Apr 27 2023, 09:52 AM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(Tullamarine @ Apr 27 2023, 02:05 AM)
Use Oxyry (https://pyob.oxyry.com/)?

You can then paste it on Online Python Compiler and share the link with your friends. It can work in web browser on phone or PC.
*
sounds great! will try it now to see if it works or not, thanks ya biggrin.gif
TSadam_lew85
post Apr 27 2023, 10:02 AM

Enthusiast
*****
Junior Member
788 posts

Joined: Nov 2007
QUOTE(Tullamarine @ Apr 27 2023, 02:05 AM)
Use Oxyry (https://pyob.oxyry.com/)?

You can then paste it on Online Python Compiler and share the link with your friends. It can work in web browser on phone or PC.
*
I googled and all of the online compiler is to share the code to friend, actually i don't want to share the code, i just want to share the program only, which means my friend just only need to tap on the app or exe file then can run it immediately.

Thanks anyway for your sharing smile.gif

This post has been edited by adam_lew85: Apr 27 2023, 10:03 AM
junyian
post Apr 27 2023, 11:19 AM

Casual
***
Junior Member
401 posts

Joined: Jan 2003


You have more options if it's for PC. If it's for smartphone, you have a lot more work to do.
Since you want this as an EXE (which means Windows only on PC), then pyinstaller (suggested by @soul78) would be the best option.
TruboXL
post Apr 27 2023, 12:59 PM

Keep on keeping on! 👍
******
Senior Member
1,050 posts

Joined: Jan 2016
From: Land of floods, Kota Tinggi


QUOTE(adam_lew85 @ Apr 26 2023, 09:52 PM)
Can this pyc file run on smartphone? My priority is to let the end user easily run my program on their smartphone
*
Short answer is yes. Do you have what in mind on how to run Python on smartphone? Do your program need GUI?

The generated .pyc file should work across architectures, meaning .pyc generated by x86_64 Windows Python should work when running on arm64 Linux Python. Of course you still need to install Python to work. Also I only tested simple hello world so far...

This post has been edited by TruboXL: Apr 27 2023, 01:00 PM
15cm
post Apr 27 2023, 06:06 PM

Casual
***
Junior Member
423 posts

Joined: Apr 2022
QUOTE(adam_lew85 @ Apr 26 2023, 11:47 PM)
ya can we convert the script into smartphone app?

or any other simple way to share my program with others and let them play it directly on their smartphone
*
there are several projects set up for these kind of requirement , however, none of those took off....

python kivy is what you are looking for

there are probably others, but very very few people use python to build mobile apps. its just not native.

-----------------------

side note : it is possible to run python script on android, just install pydroid 3. but your python script wont be a standalone app so your friend can see your script content.

This post has been edited by 15cm: Apr 27 2023, 06:07 PM
flashang
post Apr 27 2023, 06:35 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(adam_lew85 @ Apr 26 2023, 09:52 PM)
Can this pyc file run on smartphone? My priority is to let the end user easily run my program on their smartphone
*
You might need to find out how to make your program to run on smartphone.

After that, how to hide your code.

As more scam reports, people are afraid to install app from unknown source.

They might also think your chat account been hacked and send them fake app.

hmm.gif



 

Change to:
| Lo-Fi Version
0.0192sec    0.47    5 queries    GZIP Disabled
Time is now: 24th December 2025 - 09:32 PM