Tech21
Tech21

Reputation: 1

What should I do to convert a pydisasm output with pyc-xasm into another pyc file on python3.9?

There are some commands I've write on debian:

(myenv) debian@debian:~/__pycache__$ pydisasm --format xasm print-teste.cpython-39.pyc > result_v2.pyasm
(myenv) debian@debian:~/__pycache__$ pyc-xasm result_v2.pyasm
Traceback (most recent call last):
  File "/home/debian/myenv/bin/pyc-xasm", line 8, in <module>
    sys.exit(main())
  File "/home/debian/myenv/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/debian/myenv/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/debian/myenv/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/debian/myenv/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/debian/myenv/lib/python3.9/site-packages/xasm/xasm_cli.py", line 28, in main
    asm = asm_file(asm_path)
  File "/home/debian/myenv/lib/python3.9/site-packages/xasm/assemble.py", line 158, in asm_file
    python_version_pair = version_str_to_tuple(python_version, len=2)
TypeError: version_str_to_tuple() got an unexpected keyword argument 'len'

This is the pydisasm output:

# pydisasm version 6.1.1
# Python bytecode 3.9.0 (3425)
# Disassembled from Python 3.9.13 (main, Aug  6 2024, 13:33:17) 
# [GCC 12.2.0]
# Timestamp in code: 1722963360 (2024-08-06 13:56:00)
# Source code size mod 2**32: 22 bytes

# Method Name:       <module>
# Filename:          print-teste.py
# Argument count:    0
# Position-only argument count: 0
# Keyword-only arguments: 0
# Number of locals:  0
# Stack size:        2
# Flags:             0x00000040 (NOFREE)
# First Line:        1
# Constants:
#    0: 'hello world'
#    1: None
# Names:
#    0: print
  1:
            LOAD_NAME            0 (print)
            LOAD_CONST           0 ("hello world")
            CALL_FUNCTION        1 (1 positional argument)
            POP_TOP
            LOAD_CONST           1 (None)
            RETURN_VALUE

There is the --asm option but I can't make it work.

I've used the py_compile to compile print("hello world") into the pyc file.

So can anyone tell me how to work with pydisasm and pyc-xasm on python3.9?

Upvotes: 0

Views: 77

Answers (0)

Related Questions