Jump to content

[ Dead Download Link ] [HowTo] Use compiled Python files [ We Need You ]


Sanchez

Recommended Posts

  • Premium

Hi everyone,
 
In this thread I will show you how to use the compiled python files in the client. First of all we need to download Python 2.2 or 2.7

Let's start the tutorial:
 
1. Rename system.py to main.py or to anything you want, it doesn't matter.
2. Change these stuffs in main.py:
 
Search for this:

filename = name + '.py'

Replace with this:

filename = name + '.pyc'

Search for this:

newmodule = _process_result(compile(pack_file(filename,'r').read(),filename,'exec'),name)

Replace with this:

newmodule = _process_result(marshal.loads(pack_file(filename,'rb').read()[8:]),name)

Search for this:

RunMainScript("prototype.py")

Replace with this:

RunMainScript("prototype.pyc")

3. Create a new file called system.py
4. Copy this to system.py:

import pack
import imp
import marshal
data = pack.Get('main.pyc')
if data == None:
    raise IOError, 'Error happened...'

if data[:4] != imp.get_magic():
    raise ImportError, 'Error happened...'

exec marshal.loads(data[8:])

5. Let's continue with the compiling. Download this file and put to the Python 2.2 or 2.7 folder. Create a new folder called files and put all .py files from the root and the main.py to the folder. Drop the downloaded Compiler.py to the python.exe and wait few seconds, now it will compile the files. After the compiling finished copy back the .pyc files to the root and delete the old .py files.
6. Copy the system.py to the root. (Example picture)
7. Pack the root.eix/epk

If you have any question or suggestion please just reply to this topic.

Kind Regards,
Sanchez

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 1
  • Love 21
Link to comment
Share on other sites

Hi everyone,

 

In this thread I will show you how to use the compiled python files in the client. First of all we need to download Python 2.2 or 2.7

Let's start the tutorial:

 

1. Rename system.py to main.py or to anything you want, it doesn't matter.

2. Change these stuffs in main.py:

 

Search for this:

filename = name + '.py'

Replace with this:

filename = name + '.pyc'

Search for this:

newmodule = _process_result(compile(pack_file(filename,'r').read(),filename,'exec'),name)

Replace with this:

newmodule = _process_result(marshal.loads(pack_file(filename,'rb').read()[8:]),name)

Search for this:

RunMainScript("prototype.py")

Replace with this:

RunMainScript("prototype.pyc")

3. Create a new file called system.py

4. Copy this to system.py:

import pack
import imp
import marshal
data = pack.Get('main.pyc')
if data == None:
    raise IOError, 'Error happened...'

if data[:4] != imp.get_magic():
    raise ImportError, 'Error happened...'

exec marshal.loads(data[8:])

5. Let's continue with the compiling. Download this file and put to the Python 2.2 or 2.7 folder. Create a new folder called files and put all .py files from the root and the main.py to the folder. Drop the downloaded Compiler.py to the python.exe and wait few seconds, now it will compile the files. After the compiling finished copy back the .pyc files to the root and delete the old .py files.

6. Copy the system.py to the root. (Example picture)

7. Pack the root.eix/epk

If you have any question or suggestion please just reply to this topic.

Kind Regards,

Sanchez

Thanks, very useful ;)

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 4 months later...
  • 8 months later...
  • 9 months later...
  • 3 months later...
  • 7 months later...
  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.