You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Hello,
Recently I came across to this awesome project and trying tutorials in the Wiki page.
But if I run the Example/duplicate.py in Windows terminal(PowerShell), the code crashes with UnicodeDecodeError in Line 73.
To Reproduce
OS: Windows 11 (Korean, 22H2-build22621.2715)
Python: 3.10.9
Run python .\duplicate.py IPlugEffect MyNewPlugin MyNewManufacturer in Windows Terminal (or PowerShell).
Expected behaviour
After I add paramter "encoding="utf-8" like for line in fileinput.input(files,inplace=1,encoding="utf-8"): to following lines of code, it run successfully with no errors.
done - don't forget to change PLUG_UNIQUE_ID and PLUG_MFR_ID in config.h
Screenshots
(base) PS D:\CODE\iplug2\dev\iPlug2\Examples> python --version
Python 3.10.9
(base) PS D:\CODE\iplug2\dev\iPlug2\Examples> python .\duplicate.py IPlugEffect MyNewPlugin TaeinKim
IPlug Project Duplicator v0.96 by Oli Larkin ------------------------------
copying IPlugEffect folder to D:\CODE\iplug2\dev\iPlug2\Examples\MyNewPlugin
recursing in config directory:
Replacing project name strings in file IPlugEffect-ios.xcconfig
Replacing captitalized project name strings in file IPlugEffect-ios.xcconfig
Replacing manufacturer name strings in file IPlugEffect-ios.xcconfig
Renaming file IPlugEffect-ios.xcconfig to MyNewPlugin-ios.xcconfig
Replacing project name strings in file IPlugEffect-mac.xcconfig
Replacing captitalized project name strings in file IPlugEffect-mac.xcconfig
Replacing manufacturer name strings in file IPlugEffect-mac.xcconfig
Renaming file IPlugEffect-mac.xcconfig to MyNewPlugin-mac.xcconfig
Replacing project name strings in file IPlugEffect-web.mk
Replacing captitalized project name strings in file IPlugEffect-web.mk
Replacing manufacturer name strings in file IPlugEffect-web.mk
Renaming file IPlugEffect-web.mk to MyNewPlugin-web.mk
Replacing project name strings in file IPlugEffect-win.props
Replacing captitalized project name strings in file IPlugEffect-win.props
Replacing manufacturer name strings in file IPlugEffect-win.props
Renaming file IPlugEffect-win.props to MyNewPlugin-win.props
Replacing project name strings in file config.h
Replacing captitalized project name strings in file config.h
Replacing manufacturer name strings in file config.h
recursing in installer directory:
Replacing project name strings in file changelog.txt
Replacing captitalized project name strings in file changelog.txt
Replacing manufacturer name strings in file changelog.txt
Replacing project name strings in file intro.rtf
Replacing captitalized project name strings in file intro.rtf
Replacing manufacturer name strings in file intro.rtf
NOT replacing name strings in file IPlugEffect-installer-bg.png
Renaming file IPlugEffect-installer-bg.png to MyNewPlugin-installer-bg.png
Replacing project name strings in file IPlugEffect.iss
Replacing captitalized project name strings in file IPlugEffect.iss
Replacing manufacturer name strings in file IPlugEffect.iss
Renaming file IPlugEffect.iss to MyNewPlugin.iss
Replacing project name strings in file IPlugEffect.pkgproj
Replacing captitalized project name strings in file IPlugEffect.pkgproj
Replacing manufacturer name strings in file IPlugEffect.pkgproj
Renaming file IPlugEffect.pkgproj to MyNewPlugin.pkgproj
Replacing project name strings in file known-issues.txt
Replacing captitalized project name strings in file known-issues.txt
Replacing manufacturer name strings in file known-issues.txt
Replacing project name strings in file license.rtf
Replacing captitalized project name strings in file license.rtf
Replacing manufacturer name strings in file license.rtf
Replacing project name strings in file readme-osx.rtf
Replacing captitalized project name strings in file readme-osx.rtf
Replacing manufacturer name strings in file readme-osx.rtf
Replacing project name strings in file readme-win.rtf
Replacing captitalized project name strings in file readme-win.rtf
Replacing manufacturer name strings in file readme-win.rtf
Replacing project name strings in file IPlugEffect.code-workspace
Replacing captitalized project name strings in file IPlugEffect.code-workspace
Replacing manufacturer name strings in file IPlugEffect.code-workspace
Renaming file IPlugEffect.code-workspace to MyNewPlugin.code-workspace
Replacing project name strings in file IPlugEffect.cpp
Replacing captitalized project name strings in file IPlugEffect.cpp
Replacing manufacturer name strings in file IPlugEffect.cpp
Renaming file IPlugEffect.cpp to MyNewPlugin.cpp
Replacing project name strings in file IPlugEffect.h
Replacing captitalized project name strings in file IPlugEffect.h
Replacing manufacturer name strings in file IPlugEffect.h
Renaming file IPlugEffect.h to MyNewPlugin.h
Replacing project name strings in file IPlugEffect.RPP
Replacing captitalized project name strings in file IPlugEffect.RPP
Replacing manufacturer name strings in file IPlugEffect.RPP
Renaming file IPlugEffect.RPP to MyNewPlugin.RPP
Replacing project name strings in file IPlugEffect.sln
Traceback (most recent call last):
File "D:\CODE\iplug2\dev\iPlug2\Examples\duplicate.py", line 248, in <module>
main()
File "D:\CODE\iplug2\dev\iPlug2\Examples\duplicate.py", line 229, in main
for dir in dirwalk(outputpath, inputprojectname, outputprojectname, "AcmeInc", manufacturer, oldroot, newroot):
File "D:\CODE\iplug2\dev\iPlug2\Examples\duplicate.py", line 131, in dirwalk
replacestrs(fullpath, searchproject, replaceproject)
File "D:\CODE\iplug2\dev\iPlug2\Examples\duplicate.py", line 73, in replacestrs
for line in fileinput.input(files,inplace=1):
File "C:\Users\tikim\anaconda3\lib\fileinput.py", line 256, in __next__
line = self._readline()
File "C:\Users\tikim\anaconda3\lib\fileinput.py", line 392, in _readline
return self._readline()
UnicodeDecodeError: 'cp949' codec can't decode byte 0xbf in position 2: illegal multibyte sequence
(base) PS D:\CODE\iplug2\dev\iPlug2\Examples>
IMPORTANT DETAILS
What plug-in format does it relate to - Maybe none
What platform does it relate to - Windows
What IGRAPHICS_BACKEND does it relate to - Maybe none
Additional context
In the error message UnicodeDecodeError: 'cp949' codec can't decode byte 0xbf in position 2: illegal multibyte sequence, cp949 is Korean encoding made by Microsoft Windows (maybe like Japanese encoding of EUC-JP?).
Even in Windows 11, the default encoding in Korean Windows is CP949.
It could be awkward that why the encoding of text(code) files cloned from this repository is regarded as CP949, not ASCII.
Maybe CP949 is made to be superset of ASCII, so Korean Windows always regard ASCII text file as CP949.
Describe the bug
Hello,
Recently I came across to this awesome project and trying tutorials in the Wiki page.
But if I run the
Example/duplicate.py
in Windows terminal(PowerShell), the code crashes with UnicodeDecodeError in Line 73.To Reproduce
Run
python .\duplicate.py IPlugEffect MyNewPlugin MyNewManufacturer
in Windows Terminal (or PowerShell).Expected behaviour
After I add paramter "encoding="utf-8" like
for line in fileinput.input(files,inplace=1,encoding="utf-8"):
to following lines of code, it run successfully with no errors.iPlug2/Examples/duplicate.py
Line 73 in fe1ca6f
iPlug2/Examples/duplicate.py
Line 80 in fe1ca6f
Screenshots
IMPORTANT DETAILS
Additional context
In the error message
UnicodeDecodeError: 'cp949' codec can't decode byte 0xbf in position 2: illegal multibyte sequence
, cp949 is Korean encoding made by Microsoft Windows (maybe like Japanese encoding of EUC-JP?).Even in Windows 11, the default encoding in Korean Windows is CP949.
It could be awkward that why the encoding of text(code) files cloned from this repository is regarded as CP949, not ASCII.
Maybe CP949 is made to be superset of ASCII, so Korean Windows always regard ASCII text file as CP949.
It seems that my solution(adding encoding parameter) can only be work in the Python >= 3.10 .
https://stackoverflow.com/a/69508474
If this matters, fileinput.input may be replaced to another function to prevent the encoding issue?
The text was updated successfully, but these errors were encountered: