Skip to content

some wrong with pyenv when handle the equivalence results #127

@debugpro

Description

@debugpro

my windows pc: win10 pro x64
python env: python 3.12.0

i setup the env by the guide https://github.com/pyenv-win/pyenv-win,
and set pyenv global 3.12.0,
when i decompile the pyc file, it got error below:

               ┌────────────────── Traceback (most recent call last) ──────────────────┐
                │ E:\download\pylingual-main\pylingual\main.py:122 in main              │
                │                                                                       │
                │   119 │   │   │   │   raise FileNotFoundError(f"pyc file {pyc_path} d │
                │   120 │   │   │                                                       │
                │   121 │   │   │   try:                                                │
                │ > 122 │   │   │   │   result = decompile(                             │
                │   123 │   │   │   │   │   pyc=pyc_path,                               │
                │   124 │   │   │   │   │                                               │
                │       save_to=Path(f"{out_dir}/decompiled_{pyc_path.with_suffix('.py' │
                │       f"decompiled_{pyc_path.with_suffix('.py').name}"),              │
                │   125 │   │   │   │   │   config_file=Path(config_file) if config_fil │
                │                                                                       │
                │ E:\download\pylingual-main\pylingual\decompiler.py:477 in decompile   │
                │                                                                       │
                │   474 │   else:                                                       │
                │   475 │   │   logger.info(f"Decompiling pyc {pyc.pyc_path.resolve() i │
                │       repr(pyc)}")                                                    │
                │   476 │   decompiler = Decompiler(pyc, segmenter, translator, pversio │
                │ > 477 │   result = decompiler()                                       │
                │   478 │                                                               │
                │   479 │   logger.info("Decompilation complete")                       │
                │   480 │   logger.info(f"{result.calculate_success_rate():.2%} code ob │
                │                                                                       │
                │ E:\download\pylingual-main\pylingual\decompiler.py:129 in __call__    │
                │                                                                       │
                │   126 │   │   │   │   logger.warning(f"pyenv is not installed so equi │
                │       performed. Please install pyenv manually along with the require │
                │       ({self.version}) or run PyLingual again with the --init-pyenv f │
                │   127 │   │   │   │   return DecompilerResult(self.indented_source, [ │
                │       compare equivalence without pyenv installed", bc, bc) for bc in │
                │       self.pyc.iter_bytecodes()], self.pyc, self.version)             │
                │   128 │   │   │                                                       │
                │ > 129 │   │   │   self.equivalence_results = self.check_reconstructio │
                │   130 │   │   │   self.correct_failures()                             │
                │   131 │   │   │                                                       │
                │   132 │   │   │   if has_comp_error(self.equivalence_results):        │
                │                                                                       │
                │ E:\download\pylingual-main\pylingual\decompiler.py:361 in             │
                │ check_reconstruction                                                  │
                │                                                                       │
                │   358 │   │   pyc = self.tmpfile()                                    │
                │   359 │   │   src.write_text(source, encoding='utf-8')                │
                │   360 │   │   try:                                                    │
                │ > 361 │   │   │   compile_version(src, pyc, self.version)             │
                │   362 │   │   except CompileError as e:                               │
                │   363 │   │   │   return [e]                                          │
                │   364 │   │   else:                                                   │
                │                                                                       │
                │ E:\download\pylingual-main\pylingual\utils\generate_bytecode.py:46 in │
                │ compile_version                                                       │
                │                                                                       │
                │   43 │   │   │   │   return None                                      │
                │   44 │   │                                                            │
                │   45 │   │   pyenv_versions_cmd = [which_pyenv, *"versions --bare".sp │
                │ > 46 │   │   pyenv_versions_output = subprocess.run(pyenv_versions_cm │
                │      capture_output=True, text=True)                                  │
                │   47 │   │   if pyenv_versions_output.stderr:                         │
                │   48 │   │   │   raise CompileError(pyenv_versions_output.stderr)     │
                │   49 │   │   # get lastest pyenv version for the correct major.minor  │
                │                                                                       │
                │ C:\Users\xxx\.pyenv\pyenv-win\versions\3.12.0\Lib\subpro │
                │ cess.py:548 in run                                                    │
                │                                                                       │
                │    545 │   │   kwargs['stdout'] = PIPE                                │
                │    546 │   │   kwargs['stderr'] = PIPE                                │
                │    547 │                                                              │
                │ >  548 │   with Popen(*popenargs, **kwargs) as process:               │
                │    549 │   │   try:                                                   │
                │    550 │   │   │   stdout, stderr = process.communicate(input, timeou │
                │    551 │   │   except TimeoutExpired as exc:                          │
                │                                                                       │
                │ C:\Users\xxx\.pyenv\pyenv-win\versions\3.12.0\Lib\subpro │
                │ cess.py:1026 in __init__                                              │
                │                                                                       │
                │   1023 │   │   │   │   │   self.stderr = io.TextIOWrapper(self.stderr │
                │   1024 │   │   │   │   │   │   │   encoding=encoding, errors=errors)  │
                │   1025 │   │   │                                                      │
                │ > 1026 │   │   │   self._execute_child(args, executable, preexec_fn,  │
                │   1027 │   │   │   │   │   │   │   │   pass_fds, cwd, env,            │
                │   1028 │   │   │   │   │   │   │   │   startupinfo, creationflags, sh │
                │   1029 │   │   │   │   │   │   │   │   p2cread, p2cwrite,             │
                │                                                                       │
                │ C:\Users\xxx\.pyenv\pyenv-win\versions\3.12.0\Lib\subpro │
                │ cess.py:1538 in _execute_child                                        │
                │                                                                       │
                │   1535 │   │   │                                                      │
                │   1536 │   │   │   # Start the process                                │
                │   1537 │   │   │   try:                                               │
                │ > 1538 │   │   │   │   hp, ht, pid, tid = _winapi.CreateProcess(execu │
                │   1539 │   │   │   │   │   │   │   │   │   │    # no special security │
                │   1540 │   │   │   │   │   │   │   │   │   │    None, None,           │
                │   1541 │   │   │   │   │   │   │   │   │   │    int(not close_fds),   │
                └───────────────────────────────────────────────────────────────────────┘
                OSError: [WinError 193] %1 不是有效的 Win32 应用程序。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions