473,699 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can .py be complied?

Hi all, I am new to programming, already have a glace on introduction of
c++, java and finally decided on python. But I found that the .py file is
just like the source file, how can I make a program without revealing its
source? (may be my question is a little bit stupid)
Jul 19 '05 #1
30 2124
Hi monkey,

Not a stupid question especially if you're trying to create commercial
software and don't want to reveal your source. At any rate, you can use
py2exe to create a .exe file. It does have some cons to it since you
are compiling an interpreted script but it works fine in this capacity.
If you would like to obfuscate your code (disguise it) without an
executable you can try pyobfuscate as well. Just Google for these two
and you'll find easily.

Harlin Seritt

Jul 19 '05 #2
monkey wrote:
Hi all, I am new to programming, already have a glace on introduction of
c++, java and finally decided on python. But I found that the .py file is
just like the source file, how can I make a program without revealing its
source? (may be my question is a little bit stupid)


It is generally not very easy or straight-forward. The developers of
CPython had generally intended that the source codes be the actual
distribution, and is not likely to change. (see the thread on "bytecode
non-backcompatibili ty")

For now, you can use pyfreeze to snap the application, which is to
bundle your application to a python interpreter (bootstrapping) as a
package but this will not create a portable application. You can only
run the application on the native system that it is frozen on. For
example, if i freeze my application on Mac OSX, I won't be able to run
that on MS Windows. Freezing bootstraps the system's python onto the
application.

If your application does not use any C modules, you can try to use
Jython instead. Program in python but use jythonc to convert it into
Java source files and package it into Java JAR files, then you will only
need to release the JAR files without needing to release your codes.

Cheers
Maurice
Jul 19 '05 #3
I don't know the exact details, but try using the compiled Python
scripts (bytecode). I believe they are semi-optimized and platform
independent. They are the .pyc and .pyo files generated when the script
is run.

Jul 19 '05 #4

ry**@ryankaskel .com wrote:
I don't know the exact details, but try using the compiled Python
scripts (bytecode). I believe they are semi-optimized and platform
independent. They are the .pyc and .pyo files generated when the script is run.


Okay, I found this documentation
<http://fux0r.phathooku ps.com/programming-tutorials/Python/tut/node43.html>.
It hides the source but you still need Python installed on the system
running the bytecode.

Jul 19 '05 #5
Thanks all of you guys, I found that python newsgroup is of wealthy
knowledge:
If you would like to obfuscate your code (disguise it) without an
executable you can try pyobfuscate as well.

Harlin Seritt

Yes, I want more options. Since the python doc mentioned py2exe only, and it
is difficult to understand how it work.(may be you guys know C and make
file, but I am still foolish here...)
It is generally not very easy or straight-forward.
For now, you can use pyfreeze to snap the application.... .
If your application does not use any C modules, you can try to use
Jython instead.

Cheers
Maurice
If using Jython to complie, is the end-user need JRE instead of Python
installed, or need both of them?
I don't know the exact details, but try using the compiled Python
scripts (bytecode). I believe they are semi-optimized and platform
independent. They are the .pyc and .pyo files generated when the script
is run.

ryan@ryankaske l


Is that means a .py convert to .pyc or .pyo, without the need of "make file"
as using py2exe?
Jul 19 '05 #6

U¿ytkownik "monkey" <m@m.com> napisa³ w wiadomo¶ci
news:42******** **@rain.i-cable.com...
If using Jython to complie, is the end-user need JRE instead of
Python
installed, or need both of them?


Only JRE. Just like Java.
I don't know the exact details, but try using the compiled Python
scripts (bytecode). I believe they are semi-optimized and platform
independent. They are the .pyc and .pyo files generated when the
script
is run.

Is that means a .py convert to .pyc or .pyo, without the need of
"make file"
as using py2exe?


..pyc files are generated every time a module (any .py file can be a
module) is imported. So if you have a program, say, example.py, you
just start the python interpreter and write:
import example

And then example.pyc will appear beside example.py. This new file does
not require example.py (you can even delete it), and works on any
computer with Python installed (on Windows you can just double-click
it)
If you start the Python interpreter using:
python -OO (if you are using Windows, you shoud start the interpreter
from the command line, probably something like:
c:
cd \
python24\python -OO)
and then import your example.py, you will get a file example.pyo,
which is also stripped of any documentation strings (a bit harder to
decode).

regards,
Filip Dreger
Jul 19 '05 #7
monkey wrote:
It is generally not very easy or straight-forward.
For now, you can use pyfreeze to snap the application.... .
If your application does not use any C modules, you can try to use
Jython instead.

Cheers
Maurice

If using Jython to complie, is the end-user need JRE instead of Python
installed, or need both of them?


The end-user needs the JRE, not Python.

Kent
Jul 19 '05 #8
ry**@ryankaskel .com wrote:
ry**@ryankaskel .com wrote:
I don't know the exact details, but try using the compiled Python
scripts (bytecode). I believe they are semi-optimized and platform
independent . They are the .pyc and .pyo files generated when the


script
is run.

Okay, I found this documentation
<http://fux0r.phathooku ps.com/programming-tutorials/Python/tut/node43.html>.
It hides the source but you still need Python installed on the system
running the bytecode.


But those files can be decompyled.

--
--------------------------
Lucas Raab
lvraab"@"earthl ink.net
dotpyFE"@"gmail .com
AIM: Phoenix11890
MSN: dotpyfe"@"gmail .com
IRC: lvraab
ICQ: 324767918
Yahoo: Phoenix11890
Jul 19 '05 #9

"Maurice LING" <ma*********@ac m.org> wrote:
news:d4******** **@domitilla.ai oe.org...
If your application does not use any C modules, you can try to use
Jython instead. Program in python but use jythonc to convert it into
Java source files and package it into Java JAR files, then you will only
need to release the JAR files without needing to release your codes.


using Jython will not helps to hide your sources - jar-files are also easy
to decompile and to receive the source code (it will even looks like
original).
To avoid releasing your java-code (as far as it possible), the jar-files are
also necessary for processing by obfuscators
--
Best regards,
Maksim Kasimov
mailto: ka*****@i.com.u a
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
4066
by: Pmb | last post by:
I'm confused as to what the compiler error message I'm getting is refering to. Can someone take a gander and let me know what I did wrong? The program is below. When I compile it I get the following error ______________________________ Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland d:\temp\complex\temp.cpp: Error E2333 d:\temp\complex\temp.cpp 73: Class member 'Complex::conjugate(Complex)' declared outside its class Error...
12
1602
by: kim | last post by:
The c program is an example and should be correct. I tried to compile the c file with MS studio 6.0. But failed with the several err and warning messages. Does anyone know how to make it work? Thanks. Here is the c file: /*file name way.c*/ #include <stdio.h>
5
1250
by: Martin | last post by:
Hi All, Im looking forward for info whether VB.NET complied application would run in Windows 98 or not ? Does any one have tried to do so ?? Regards, Martin
0
9180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7755
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6536
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2012
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.