pyarmor icon indicating copy to clipboard operation
pyarmor copied to clipboard

[BUG] --mix-str causes error

Open usmanov-danil opened this issue 3 years ago • 3 comments

pyarmor 7.6.1, python 3.7

PYTHONOPTIMIZE=2 pyarmor obfuscate --advanced 2 --mix-str --obf-code 2 --restrict 2 --src="." -r --output=/new_app entry.py
#21 16.15 ERROR    from __future__ imports must occur at the beginning of the file (<frozen {file_name}>, line 2)
------
executor failed running [/bin/bash -c PYTHONOPTIMIZE=2 pyarmor obfuscate --advanced 2 --mix-str --obf-code 2 --restrict 2 --src="." -r --output=/new_app entry.py]: exit code: 1

usmanov-danil avatar Aug 18 '22 14:08 usmanov-danil

I'm in holiday, I'll check this when I'm back about next month.

BTW, could you provide the simple script to reproduce this issue?

jondy avatar Aug 25 '22 07:08 jondy

Yes, of course.

""" Some comment"""
from __future__ import annotations

from datetime import datetime
from typing import TYPE_CHECKING

from pydantic import BaseModel
if TYPE_CHECKING:
    from typing import Dict, List


class SomeModel(BaseModel):
    some_str: str
    created_at: datetime
    mapping: Dict[str, List[int]]

Have a good rest!

usmanov-danil avatar Aug 25 '22 11:08 usmanov-danil

It has been fixed in this pre-release version pip install https://pyarmor.dashingsoft.com/downloads/temp/pyarmor-7.6.2.zip

jondy avatar Sep 01 '22 23:09 jondy