Python Error : read excel file(included xlsx, ...)

 An internal security tool caused a problem because xlsx was locked into a security program.
In conclusion, the following method was used, but it could not be solved.

error handling step...

code : occurred openpyxl error  

< zipfile.BadZipFile: File is not a zip file >


import openpyxl

 

if __name__ == "__main__" :

    wb = openpyxl.load_workbook("contents.xlsx")

    print(f"{wb}")

error

zipfile.BadZipFile: File is not a zip file


The following methods were used to solve this problem caused by in-house security tools.


step 1. encoding error 

< UnicodeDecodeError: 'cp949' codec can't decode byte 0xf0 in position 20: illegal multibyte sequence >


import openpyxl

import xlrd #add

if __name__ == "__main__" :

    file = open("contents.xlsx","r")

    wb = xlrd.open_workbook(file_contents=file.read()) #add

    print(f"wb")

 

error

wb = xlrd.open_workbook(file_contents=file.read())

UnicodeDecodeError: 'cp949' codec can't decode byte 0xf0 in position 20: illegal multibyte sequence



step 2. encoding error : add utf-8

< TypeError: an integer is required (got type str) >


import openpyxl

import xlrd

if __name__ == "__main__" :

    file = open("contents.xlsx","r", "utf-8")

    wb = xlrd.open_workbook(file_contents=file.read())

    print(f"wb")

 

error

file = open("contents.xlsx","r","utf-8")

TypeError: an integer is required (got type str)

must be specified Encoding type like "utf-8" as "python2 -> python3".



step 3. ???
< TypeError: an integer is required (got type str) >

import openpyxl

import xlrd

if __name__ == "__main__" :

    file = open("contents.xlsx","r", encoding="utf-8")

    wb = xlrd.open_workbook(file_contents=file.read())

    print(f"wb")

 

error

file = open("contents.xlsx","r", encoding="utf-8")

TypeError: an integer is required (got type str)

"utf-8-> encoding="utf-8"



It still hasn't been resolved.
Does anyone know how to read the Excel file that was locked due to the security tool?


#python error #read excel #openpyxl #zipfile.BadZipFile #encoding error

How to create qrc file(qml) in Python Qt(PyQt)

1. create qml file 
 - main.qml 
 - test.qml


2. create resource.qrc file
resource.qml code

-----------------------------------

<RCC>

<qresource>

    <file>qml/main.qml</file>

    <file>qml/test.qml</file>

</qresource>

</RCC>
-----------------------------------


3. execute command in terminal (in workspace included qml files)
 $ pyside2-rcc -o resource.py resource.qrc


4. check resource.py file 
 : 
Completed when the resource.py file is created.

 

 

How to use qrc file!

1. in main.py 

ex ) qrc:///filename

QUrl("qrc:///qml/test.qml")

 

2. in main.qml file

ex ) qrc:/qml/test.qml

source: "qrc:/qml/test.qml"


#qrc #resource.qrc #resource.py #python #qt #pyqt #pyside2-rcc


How to remove a square box from a blog post. (with chrome)



ISSUE:
When you read a blog post with chrome, there's an issue where a square box.

Description:
There is an issue in which a square box appears in a blog post as follows.

This issue is only visible to Chrome users and is not a blog problem or a problem with the text itself.

This issue is due to the chrome extension plug-in currently running by the reader.
It is said that a square box can be seen if there is an extension related to the pop-up or a pop-up during the chrome extension plug-in.

In my case, the issue occurred due to "Google translation" plug-in.
Therefore, the issue is solved by shutting down the plug-in or using other Internet Explorers (explorer, edge, safari, etc.).

#blog #blogIssue #squarebox

Python error : pip installer ssl

solve :


pip install [item] --trusted-host pypi.org --trusted-host files.pythonhosted.org

ex)

$ pip install requests --trusted-host pypi.org --trusted-host files.pythonhosted.org
$ pip install psutil --trusted-host pypi.org --trusted-host files.pythonhosted.org
$ pip install --upgrade paramiko --trusted-host pypi.org --trusted-host files.pythonhosted.org
$ pip install --upgrade scp --trusted-host pypi.org --trusted-host files.pythonhosted.org


#python #pip #pip3 #error #--trusted-host #pypi.org #pythonhosted #ssl

How to check variant type in C++

 C++ example:

#include <typeinfo>
#include <iostream>
int main() {
int nInt;
char cChar;
std::cout<<"nInt type = " << typeid(nInt).name() <<std::endl;
std::cout<<"cChar type = " << typeid(cChar).name() <<std::endl;
return 0;
}
if you define #include <typeinfo>, you can know type info of the variant.

How to build multi binaries through cmake.

Topic :

1. How to build multi binaries through cmake.
2. How to make multi binaries by preprocess.


Linux Line Feed? Carriage Return? Remove ^M

linux "^M" issue

If you look the shell script or code sent from Windows to the Linux server, you may find "^M" at the end of the line.

ex 1 )
echo test^M


ex 2)

#include <iostream>^M
#include <string>^M


Solve :

all remove ^M

 $ vi source.cpp
 
:1,$s/^M//g

^M : ctrl+N and ctrl+M


알뜰폰 삼성페이 교통카드 '한도 초과' 오류(등록 불가 오류) 해결방법

sk7mobile 알뜰폰 삼성페이 교통카드 등록 시, 한도 초과 문제 해결방법 skt usim 해킹 사건으로 인해 sk7mobile 알뜰폰을 사용하는 저도 usim을 바꾸고 나니 삼성페이 교통카드가 등록이 안되더라구요...  삼성페이 교통카드 기능 은...