Git Product home page Git Product logo

Comments (11)

Sei-Lisa avatar Sei-Lisa commented on July 29, 2024

from lsl-pyoptimizer.

PeterStindberg avatar PeterStindberg commented on July 29, 2024

Sure thing

macOS Mojave 10.14.6
Python 2.7.16

Traceback (most recent call last):
  File "/GitHub/LSL-PyOptimizer/main.py", line 782, in <module>
    ret = main(sys.argv)
  File "/GitHub/LSL-PyOptimizer/main.py", line 745, in main
    script = script_header + script_timestamp + outs.output(ts, options)
  File "/GitHub/LSL-PyOptimizer/lslopt/lsloutput.py", line 556, in output
    ret += self.OutCode(node)
  File "/GitHub/LSL-PyOptimizer/lslopt/lsloutput.py", line 504, in OutCode
    ret += self.OutCode(stmt)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2896: ordinal not in range(128)

LANG="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_CTYPE="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_ALL=

What do you mean with "encoding of your script"?

from lsl-pyoptimizer.

Sei-Lisa avatar Sei-Lisa commented on July 29, 2024

from lsl-pyoptimizer.

PeterStindberg avatar PeterStindberg commented on July 29, 2024

Yes, it's UTF-8.

And indeed I am using (few) non-ASCII char's. There are passages like this:

list replace = ["&lt;","<","&gt;",">","&rt;",">","&quote;","\"","&quot;","\"","&amp;","&","&cent;","¢","&pound;","£","&yen;","¥","&euro;","€","&copy;","©","&reg;","®","&#39;","'"];

and passages like this:

msg = "*❮ [" + legacy_name + "](https://my.secondlife.com/" + legacy_name_dots +")*";

I can try to comb through them, and see what happens.

from lsl-pyoptimizer.

PeterStindberg avatar PeterStindberg commented on July 29, 2024

Unfortunately, that didn't solved the problem. I replaced every non-ascii character with llChar(xxxx) and ran the code through https://pages.cs.wisc.edu/~markm/ascii.html to find any non-ascii left over. The code is clean, the error message the same:

Traceback (most recent call last):
  File "/GitHub/LSL-PyOptimizer/main.py", line 782, in <module>
    ret = main(sys.argv)
  File "/GitHub/LSL-PyOptimizer/main.py", line 745, in main
    script = script_header + script_timestamp + outs.output(ts, options)
  File "/GitHub/LSL-PyOptimizer/lslopt/lsloutput.py", line 556, in output
    ret += self.OutCode(node)
  File "/GitHub/LSL-PyOptimizer/lslopt/lsloutput.py", line 504, in OutCode
    ret += self.OutCode(stmt)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2917: ordinal not in range(128)

from lsl-pyoptimizer.

Sei-Lisa avatar Sei-Lisa commented on July 29, 2024

from lsl-pyoptimizer.

PeterStindberg avatar PeterStindberg commented on July 29, 2024

oh, okay - well, since we assume it's the non-ASCII characters, a test case might be easy to put together

from lsl-pyoptimizer.

PeterStindberg avatar PeterStindberg commented on July 29, 2024

OK, this is the maximum stripped down that still fails:

list visitor_list_new;
list visitor_list_pos_old;
key owner;
key mygroup;
float xRight;
float xLeft;
float yNear;
float yFar;
float zLow;
float zHigh;

encode_and_send(string msg, key thisAvKey)
{
    integer msg_length;
}

key getAvatarGroup (key inAvatar)
{
    key result = NULL_KEY;
    return (result);
}

default
{
    state_entry()
    {
        mygroup = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0);
    }

    timer()
    {
        string msg;
        string legacy_name;
        string legacy_name_dots;
        integer numberOfKeys;
        integer i;
        key thisAvKey;
        vector agentpos;

        for (i = 0; i < numberOfKeys; ++i) {
            thisAvKey = llList2Key(visitor_list_new,i);

            if (TRUE) {

                agentpos = llList2Vector(llGetObjectDetails(thisAvKey, [OBJECT_POS]),0);

                // and break it down to x-y-z
                float avatarx = agentpos.x;
                float avatary = agentpos.y;
                float avatarz = agentpos.z;

                if ((avatarx <= xRight && avatarx >= xLeft && avatary <= yFar && avatary >= yNear && avatarz <= zHigh && avatarz >= zLow) && (getAvatarGroup(thisAvKey) == mygroup)) {

                } 
            }      
        }

        if (TRUE) {
            for (i = 0; i < numberOfKeys; i = i + 2) {
                if (TRUE) {
                    thisAvKey = llList2Key(visitor_list_pos_old,i);
                    legacy_name = llKey2Name(thisAvKey);
                    if (legacy_name != "") {

                        if (TRUE) {
                            msg = "*" + llChar(0x276E) + " [" + legacy_name + "](https://my.secondlife.com/" + legacy_name_dots +")*";
                            encode_and_send(msg, thisAvKey);
                        }
                    } 
                }
            }
        }
    } 
}

from lsl-pyoptimizer.

Sei-Lisa avatar Sei-Lisa commented on July 29, 2024

from lsl-pyoptimizer.

PeterStindberg avatar PeterStindberg commented on July 29, 2024

Yep, the new version works without any error message, and produces the expected output. Thank you very much!

For laymen: What was the issue?

from lsl-pyoptimizer.

PeterStindberg avatar PeterStindberg commented on July 29, 2024

nvm, found the commit and the explanation

from lsl-pyoptimizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.