473,748 Members | 6,412 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 2133
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
4081
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
1608
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
1252
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
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
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...
1
9325
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
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
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
4607
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
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.