[Question] Python debugging

04/22/2020 22:44 Radu97a#1
Hello. I am new to python so if someone can help me, i would really appreciate that. How do you guys debug the python scripts inside metin2? Are you writing in the chat? Is there a better way? How do i debug the exceptions? Thank you very much
04/22/2020 22:52 senpaiex#2
Code:
import sys, os
f = open('pythonDump.txt','w')
modules_key = sys.modules.keys()
modules_dic = sys.modules
built_in = sys.builtin_module_names
for mod in modules_key:
    if mod not in built_in:
        print >>f,'\n-----MODULE------'
        print >>f,str(mod)
        print >>f,'-----------------\n'
        funcs = dir(modules_dic.get(mod))
        for func in funcs:
            print >>f,str(func)
			
f.close()
Save this as " .py " file. You can use any PythonLoader.
04/22/2020 23:01 Radu97a#3
Thank you. What i meant is that for example
I create a python script for metin2 (for example teleport)
The GUI works everything is fine, i click a button and it does nothing but it should.
How can i debug the error? How can i find what's the problem.
For example "variable x is undefined"

I've tried wrapping it in a try catch but i dont know how to get the exception message
04/22/2020 23:17 senpaiex#4
Did you check Syserr file ?
04/22/2020 23:31 Radu97a#5
In the syserr folder i can see a file generated when i run the script but there is just a bunch of numbers and a hour. I guess error codes
04/23/2020 00:20 senpaiex#6
Yes. Just use your script ( press teleport button for example ) than open last syserrfile with any text editor. Check error in syserr file.
04/23/2020 00:43 Radu97a#7
0423 01:21:22368 :: 609340520423 01:28:38816 :: 609400040423 01:28:38816 :: 609404240423 01:28:38816 :: 609383600423 01:28:38816 :: 609383600423 01:28:38817 :: 609383600423 01:28:38817 :: 609404480423 01:28:38817 :: 609404480423 01:28:38817 :: 609404680423 01:28:38817 :: 609404480423 01:28:56244 :: 609400080423 01:28:56244 :: 609403920423 01:28:56244 :: 609383280423 01:28:56244 :: 609383280423 01:28:56244 :: 609383280423 01:28:56244 :: 609404160423 01:28:56244 :: 609404160423 01:28:56244 :: 609404360423 01:28:56244 :: 609404160423 01:28:57114 :: 609400040423 01:28:57114 :: 609404240423 01:28:57114 :: 609383600423 01:28:57115 :: 609383600423 01:28:57115 :: 609383600423 01:28:57115 :: 609404480423 01:28:57115 :: 609404480423 01:28:57115 :: 609404680423 01:28:57115 :: 609404480423 01:28:12347 :: 609400080423 01:28:12347 :: 609403920423 01:28:12347 :: 609383280423 01:28:12347 :: 609383280423 01:28:12347 :: 609383280423 01:28:12347 :: 609404160423 01:28:12347 :: 609404160423 01:28:12347 :: 609404360423 01:28:12347 :: 609404160423 01:28:13040 :: 609400640423 01:28:13040 :: 609404360423 01:28:13040 :: 609383720423 01:28:13040 :: 609383720423 01:28:13040 :: 609383720423 01:28:13040 :: 609404600423 01:28:13040 :: 609404600423 01:28:13040 :: 609404800423 01:28:13040 :: 609404600423 01:29:26372 :: 609400640423 01:29:26372 :: 609404360423 01:29:26372 :: 609383720423 01:29:26372 :: 609383720423 01:29:26372 :: 609383720423 01:29:26372 :: 609404600423 01:29:26372 :: 609404600423 01:29:26372 :: 609404800423 01:29:26372 :: 609404600423 01:29:43941 :: 609400040423 01:29:43941 :: 609404240423 01:29:43941 :: 609383600423 01:29:43941 :: 609404480423 01:29:43941 :: 609404480423 01:29:43941 :: 609404480423 01:29:43941 :: 609404240423 01:29:43941 :: 609404160423 01:29:43941 :: 609404360423 01:29:43941 :: 609404280423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404360423 01:29:43941 :: 609404480423 01:29:43941 :: 609404480423 01:29:43941 :: 609404680423 01:29:43941 :: 609404480423 01:29:46169 :: 609400040423 01:29:46169 :: 609404240423 01:29:46169 :: 609383600423 01:29:46169 :: 609404480423 01:29:46169 :: 609404480423 01:29:46169 :: 609404480423 01:29:46169 :: 609404240423 01:29:46169 :: 609404160423 01:29:46169 :: 609404360423 01:29:46169 :: 609404280423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404360423 01:29:46169 :: 609404480423 01:29:46169 :: 609404480423 01:29:46169 :: 609404680423 01:29:46169 :: 609404480423 01:29:49818 :: 609400080423 01:29:49818 :: 609403920423 01:29:49818 :: 609383280423 01:29:49818 :: 609383280423 01:29:49818 :: 609383280423 01:29:49818 :: 609404160423 01:29:49818 :: 609404160423 01:29:49818 :: 609404360423 01:29:49818 :: 609404160423 01:30:18925 :: 609400080423 01:30:18925 :: 609403920423 01:30:18925 :: 609383280423 01:30:18925 :: 609383280423 01:30:18925 :: 609383280423 01:30:18925 :: 609404160423 01:30:18925 :: 609404160423 01:30:18925 :: 609404360423 01:30:18925 :: 609404160423 01:30:24927 :: 609400040423 01:30:24927 :: 609404240423 01:30:24927 :: 609383600423 01:30:24927 :: 609383600423 01:30:24928 :: 609383600423 01:30:24928 :: 609404480423 01:30:24928 :: 609404480423 01:30:24928 :: 609404680423 01:30:24928 :: 609404480423 01:30:31910 :: 609400080423 01:30:31910 :: 609403920423 01:30:31910 :: 609383280423 01:30:31910 :: 609383280423 01:30:31910 :: 609383280423 01:30:31910 :: 609404160423 01:30:31910 :: 609404160423 01:30:31910 :: 609404360423 01:30:31910 :: 609404160423 01:30:43110 :: 609400040423 01:30:43110 :: 609404240423 01:30:43110 :: 609383600423 01:30:43110 :: 609383600423 01:30:43111 :: 609383600423 01:30:43111 :: 609404480423 01:30:43111 :: 609404480423 01:30:43111 :: 609404680423 01:30:43111 :: 609404480423 01:30:43902 :: 609400040423 01:30:43902 :: 609404240423 01:30:43902 :: 609383600423 01:30:43902 :: 609383600423 01:30:43903 :: 609383600423 01:30:43903 :: 609404480423 01:30:43903 :: 609404480423 01:30:43903 :: 609404680423 01:30:43903 :: 609404480423 01:30:55885 :: 609400080423 01:30:55885 :: 609403920423 01:30:55885 :: 609383280423 01:30:55885 :: 609383280423 01:30:55886 :: 609383280423 01:30:55886 :: 609404160423 01:30:55886 :: 609404160423 01:30:55886 :: 609404360423 01:30:55886 :: 609404160423 01:31:57360 :: 609400040423 01:31:57360 :: 609404240423 01:31:57360 :: 609383600423 01:31:57360 :: 609383600423 01:31:57361 :: 609383600423 01:31:57361 :: 609404480423 01:31:57361 :: 609404480423 01:31:57361 :: 609404680423 01:31:57361 :: 609404480423 01:31:10247 :: 609400040423 01:31:10247 :: 609404240423 01:31:10247 :: 609383600423 01:31:10247 :: 609383600423 01:31:10248 :: 609383600423 01:31:10248 :: 609404480423 01:31:10248 :: 609404480423 01:31:10248 :: 609404680423 01:31:10248 :: 609404480423 01:31:14256 :: 609400040423 01:31:14256 :: 609404240423 01:31:14256 :: 609383600423 01:31:14257 :: 609383600423 01:31:14257 :: 609383600423 01:31:14257 :: 609404480423 01:31:14257 :: 609404480423 01:31:14257 :: 609404680423 01:31:14257 :: 609404480423 01:41:07760 :: 609400040423 01:41:07760 :: 609404240423 01:41:07760 :: 609383600423 01:41:07761 :: 609383600423 01:41:07761 :: 609404480423 01:41:07761 :: 609404480423 01:41:07761 :: 609404680423 01:41:07761 :: 60940448

This is an example of what i find in the syserr file
04/23/2020 01:03 senpaiex#8
Wow this is weird :D If you share your code maybe we can understand whats goin on there.
04/23/2020 01:51 Radu97a#9
Its not about this code. I want to know for the future how i can debug stuff
04/23/2020 12:42 senpaiex#10
I tried before debug the game (not code) but CrypTect terminate the process everytime. Its using "IsDebuggerPresent" I tried anti-antidebug tools ( like Scylla Hide etc.. ) but still CrypTect knows im debugging game. At the end i get banned :) Im still looking for a way to debug this weird game..