Category Archives: Error

[Solved] Pip install icu failed: Command “python setup.py egg_info” failed with error code 1 in

problem

Failed to install icu via pip under Mac.

Solution and reason

The cause of the problem is that a certain line of code in the icu library cannot find a file and cannot get ICU_VERSIONthe value.

# Install icu
brew install icu4c

# check newest version
ls /usr/local/Cellar/icu4c/

# Edit pyicu installer to work
git clone https://github.com/ovalhub/pyicu.git

# edit setup.py not to query for the version, i.e. change
# ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip()
# to whatever your version is, e.g.
# ICU_VERSION = '57'

# Install pyicu
env LDFLAGS=-L/usr/local/opt/icu4c/lib CPPFLAGS=-I/usr/local/opt/icu4c/include DYLD_LIBRARY_PATH=-L/usr/local/opt/icu4c/lib python setup.py build
env LDFLAGS=-L/usr/local/opt/icu4c/lib CPPFLAGS=-I/usr/local/opt/icu4c/include DYLD_LIBRARY_PATH=-L/usr/local/opt/icu4c/lib sudo python setup.py install

# Change DYLD_LIBRARY_PATH (not sure if req'd)
DYLD_LIBRARY_PATH=/usr/local/Cellar/icu4c/57.1/:$DYLD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH

# Icu works now from python, and you can proceed with polyglot
$ python
>>> import icu
$ pip install polyglot
$ python
>>> import polyglot

reference

[Solved] pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

How to Solve this error?

Solution:

brew update && brew upgrade
brew uninstall --ignore-dependencies openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

[GO]Solve request origin not allowed by Upgrader.CheckOrigin websocket cross-domain

Using websocket under the gin framework, this error will be reported if it is a cross-domain request

request origin not allowed by Upgrader.CheckOrigin

 

The websocket library used is “github.com/gorilla/websocket”

Need to add the following code:

    upgrader = websocket.Upgrader{
        ReadBufferSize:   1024 ,
        WriteBufferSize: 1024 ,
         // Resolve cross-domain problems 
        CheckOrigin: func(r *http.Request) bool {
             return  true
        },
    }

[Uniapp] Solve the error plus not defined when pushing

The code in the official document is a bit problematic. You can call the plus code with the following delay and wait for plus to load.

In addition, add the conditional compilation, only the code below the app will compile

                // #ifdef APP-PLUS
                     // trigger when the page loads   
                    setTimeout(function(){
                         if (plus){
                             var pinf = plus.push.getClientInfo();
                             var cid = pinf.clientid; // Client ID 
                            console.log (cid);
                              // Monitor system notification bar message click event 
                             plus.push.addEventListener( ' click ' , function(msg){  
                                  // Business logic code for processing click messages   
                             }, false);  
                              // Monitor and receive transparent message events   
                             plus.push.addEventListener( ' receive ' , function(msg){  
                                  // Business logic code for processing transparent messages   
                                 var options = {cover: false };
                                 plus.push.createMessage(msg, " RemoteMSG " ,options);
                             }, false );
                        }
                    }, 4000 );
                 // #endif

client_id can be obtained

Implement base64_decode in GO language to solve the problem of illegal characters

When using the base64 decode of the standard library, there will be an error of illegal characters. The following function is my test and it can be decrypted normally.

Pay attention to this parameter: base64.RawStdEncoding is the key to solving illegal characters

func Base64Decode(str string ) string {
    reader: = strings.NewReader(str)
    decoder: = base64.NewDecoder(base64.RawStdEncoding, reader)
     // Decoding 
    buf in streaming mode := make([] byte , 1024 )
     // Save the decoded data 
    dst := "" 
    for {
        n, err : = decoder.Read(buf)
        dst += string (buf[:n])
         if n == 0 || err != nil {
             break
        }
    }
    return dst
}