'str' object has no attribute 'removesuffix' on attempt access to Stock Item, after updating to 12.1

Please verify that this bug has NOT been raised before.

[X] I checked and didn't find a similar issue

Describe the bug*
After updating to 12.1 from 11.4, any attempts to open "Stock item" cause error page. You still can create stock items, but not open it.
Steps to Reproduce

Create and fill base with parts\stock items on 11.2 verions.
Update to 12.1
Try to create\open stock item

Expected behaviour
Stock item page opens.
Deployment Method

[ ] Docker
[X] Bare metal

Version Information
Sorry, we already rolled back. Only one, what i know, is python version was 3.8, we try to switch on 3.9 (python alternatives), but application is refused to start at all.
Please verify if you can reproduce this bug on the demo site.

[ ] I can reproduce this bug on the demo site.

Relevant log output
Change Error
Error object (194)
HISTORY

Type:
AttributeError
Path:
http://<IP_ADDRESS>/stock/item/435/
Info:
'str' object has no attribute 'removesuffix'
When:
Aug. 2, 2023, 10:01 p.m.
Data:
Traceback (most recent call last):

File "/opt/inventree/env/lib/python3.8/site-packages/django/core/handlers/base.py", line 204, in _get_response
response = response.render()

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/response.py", line 105, in render
self.content = self.rendered_content

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/response.py", line 83, in rendered_content
return template.render(context, self._request)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 170, in render
return self._render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
return self.nodelist.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
return self.nodelist.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
return self.nodelist.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
return self.nodelist.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)

File "/opt/inventree/env/lib/python3.8/site-packages/django/template/library.py", line 192, in render
output = self.func(*resolved_args, **resolved_kwargs)

File "/opt/inventree/InvenTree/generic/states/tags.py", line 14, in status_label
state = {cls.tag(): cls for cls in inheritors(StatusCode)}.get(typ, None)

File "/opt/inventree/InvenTree/generic/states/tags.py", line 14, in <dictcomp>
state = {cls.tag(): cls for cls in inheritors(StatusCode)}.get(typ, None)

File "/opt/inventree/InvenTree/generic/states/states.py", line 108, in tag
ref_name = cls.__name__.removesuffix('Status')

AttributeError: 'str' object has no attribute 'removesuffix'

Hello @AlxrMironovOldAcc , this is due to your python version, at least 3.9 is required. Duplicate of #5131

we try to switch on 3.9 (python alternatives), but application is refused to start at all.

Do you have a log from that?

Duplicate of #5131

@AlxrMironovOldAcc any further action on this or can we close this? It seems to be related to your Python version - you need at least 3.9 as documented here.

I have a similar issue, but a bit different: currently i have inventree v.11 and to update it to current version i installed python 3.10, made it system default. When i activate venv and invoke pip install -U -r requirements.txt the process gets interrupted with error:
Building wheels for collected packages: rapidfuzz
  Building wheel for rapidfuzz (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for rapidfuzz (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/rapidfuzz
      copying src/rapidfuzz/utils.py -> build/lib.linux-x86_64-cpython-310/rapidfuzz
      copying src/rapidfuzz/__init__.py -> build/lib.linux-x86_64-cpython-310/rapidfuzz
      copying src/rapidfuzz/process.py -> build/lib.linux-x86_64-cpython-310/rapidfuzz
      copying src/rapidfuzz/fuzz.py -> build/lib.linux-x86_64-cpython-310/rapidfuzz
      running egg_info
      writing src/rapidfuzz.egg-info/PKG-INFO
      writing dependency_links to src/rapidfuzz.egg-info/dependency_links.txt
      writing top-level names to src/rapidfuzz.egg-info/top_level.txt
      reading manifest file 'src/rapidfuzz.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'src/rapidfuzz.egg-info/SOURCES.txt'
      running build_ext
      building 'rapidfuzz.levenshtein' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/src
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Isrc/rapidfuzz-cpp/src -Isrc/rapidfuzz-cpp/extern -I/opt/inventree/env/include -I/usr/include/python3.10 -c src/py_levenshtein.cpp -o build/temp.linux-x86_64-cpython-310/src/py_levenshtein.o -O3 -std=c++14 -DVERSION_INFO=\"0.7.6\"
      src/py_levenshtein.cpp:5:10: fatal error: Python.h: No such file or directory
          5 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for rapidfuzz
Failed to build rapidfuzz
ERROR: Could not build wheels for rapidfuzz, which is required to install pyproject.toml-based projects

Could you assist me on this one?

When updating the underlying python you need to remove the virtual environment completely and set it up new - venvs are pinned to specific python versions

I did remove the old venv, created one as per described in docs, proceeded into /opt/inventree (which is my default installation location that installer made), activated new venv with source env/bin/activate and invoked pip install -U -r requirements.txt, the rest you already know.

Are you running bare metal or packaged?

Managed to update, missing python3x-dev was the culprit.
Also, when i was done with the update, i went to check if everything was present and found an interesting thing: in the build order tab, when i open\create new build order, the spinner after allocated parts keeps spinning indefinitely instead of showing how many of the parts total isnt allocated.
Same behaviour was present when i exported database and imported it on the fresh vm, same is as with updating current installation.
Might it be an issue with the db, or am i missing something?

This sounds like a different problem. Please keep issues to one per problem - it becomes hard to reference issues once they contain multiple.

Understood. I'll open another issue, this one is resolved, thanks.


Multileader attached to a line - wrong coordinates of ContextData.BasePoint

Describe the bug
Hello, I am using the library to enumerate closed polylines, free floating lines and multileaders in a dwg file. Multileaders are attached to the corners of polylines and to the start or end point of lines. One multileader can be attached to only one entity (polyline or line). I can get X/Y coords of all polylines, lines and multileaders. My aim is to know which multileader is connected to which entity (polyline or line) by comparing X/Y coords of corners (polyline) or start/end point (line) with X/Y of multileaders.
In the dwg file (attached), there is a line which has one attached multileader to its start/end point. But when I enumerate all the entities and output their X/Y coords, there is no match between multileader X/Y coord and line start/end point. The values are different. For getting multileader X/Y coord I am using the property ContextData.BasePoint.X/Y.
Then there is a polygon which has another multileader attached to its corner and their (the corner and multileader) coords match to the pixel. Could you check it please.
To Reproduce
using ACadSharp.Entities;
using ACadSharp.IO;
using ACadSharp;

CadDocument doc = DwgReader.Read(@"test.dwg");

foreach (Entity item in doc.Entities)
{
    if (item is not null && item is LwPolyline polyline)
    {
        Console.WriteLine("Polyline");
        foreach (LwPolyline.Vertex vertex in polyline.Vertices)
        {
            Console.WriteLine($"\tX = {vertex.Location.X}, Y = {vertex.Location.Y}");
        }
    }
    else if (item is not null && item is Line line)
    {
        Console.WriteLine("Line");
        Console.WriteLine($"\tstart X = {line.StartPoint.X}, start Y = {line.StartPoint.Y}, end X = {line.EndPoint.X}, end Y = {line.EndPoint.Y}");
    }
    else if (item is not null && item is MultiLeader multiLeader)
    {
        Console.WriteLine("multiLeader");
        Console.WriteLine($"\tX = {multiLeader.ContextData.BasePoint.X}, Y = {multiLeader.ContextData.BasePoint.Y}, Text = {multiLeader.ContextData.TextLabel}");
    }
}

Console.ReadLine();

Expected behavior
Coords of mltileaders attached to start/end point or corners of polygon should have correct coords (same as the corresponding corner or start/end point).
Screenshots
This is an output of the code snippet above. The mutlileader with text vnitrni cara is attached to the Line yet their coords do not match.

Here is a screenshot of the dwg with circled multileader attached to an end point of the line.

Additional context
test.zip

Hi @blahetal,
The connection points that you are looking for are stored in ContextData.LeaderRoots[].Lines[].Points[].
You will need to iterate throw a couple of lists due the multileaders support multiple lines/points to be attached to.
Let me know if this helps!

thank you, that was the correct property to get the coords from


There is an error in predicting use weights from other machine .

hi，the error is  " You are trying to load a weight file containing 2 layers into a model with 44 layers " .

but when i  modify  ‘backend.py’ line 162
self.feature_extractor.load_weights(FULL_YOLO_FEATURE_PATH)
to
self.feature_extractor.load_weights(FULL_YOLO_FEATURE_PATH,by_name=True)
solve it !

Sorry for not being clear enough. You may have used the wrong weight file. Please read Section 2. Edit the configuration file carefully.

the weight is correct , it can be ran in training's machine .

@stephen-v How's the result? I guess that it's not good as the weights of the backend is not loaded properly if you use by_name=True. It only loads the layers with the names present in the weight file. The other layers are igored.

the result seem to be correct . same code , we trained in Linux  and ran in windows


Updated the binary libs from exlibs/libs-ios

Updated the binary libs from exlibs/libs-ios in order to work with Xcode 8 and iOS 10.

What about libvorbisenc.a and libvorbisfile.a? Are they now included in libvorbis?

AFAIK, libvorbis contains everything now. I took the source code from here https://xiph.org/downloads/ . No libvorbisenc or libvorbisfile in there.

Yes, I vaguely remember them including everything in a more "recent" up to date.

Are the headers still compatible? Or would we have to update everything at once?

My SFML build uses the headers provided here, I've changed only the compiled libraries.

Btw. do these libs now contain multiple version for armv7, arm64, i386, x86_64? And is that reason why they are relatively large compared to say Windows libs?

Yes, these are fat binaries which contains armv7, arm64, i386 and x86_64.

You can check this with something like:
xcrun lipo -info <lib_name>.a

Thanks! I'll mark this then ready for merging.
We greatly appreciate any other contributions you could make with regards to iOS.

Merged in 700fc7d9e0f97c7cf1b9be28dcb01d766a451d04


Trim the contact address before adding it

Because:

Technically: addresses with spaces don't exist
Functionally: a user may add an address with a space in it and wait for an
authorization that would never come

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

Hey Ingo,
I signed the CLA. ;)


Remap PrtSc to alt key

Hi
I have a PrtSc key between my ralt and rctrl keys but when I try to remap it to ralt it still output as prnt key using the xev
Here's my config
(defcfg
  fallthrough true
  allow-cmd true
  ;; For Linux
  input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
  output (uinput-sink
	  "My output"
          "sleep 1 && setxkbmap -option compose:ralt")

  cmp-seq ralt ;; set the compose key to `RightAlt`
)

(defsrc
  esc  f1   f2   f3   f4   f5   f6   f7   f8   f9   f10  f11  f12  home end  ins  del
  grv  1    2    3    4    5    6    7    8    9    0    -     =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [     ]    \
  caps a    s    d    f    g    h    j    k    l    ;    '          ret
  lsft z    x    c    v    b    n    m    ,    .    /               rsft
  wkup lctl lmet lalt           spc            ralt prnt rctl  pgdn up   pgup
                                                               left down rght
)

(deflayer mylayer
  esc  f1   f2   f3   f4   f5   f6   f7   f8   f9   f10  f11  f12  home end  ins  del
  grv       1    2    3    4    5    6    7    8    9    0    -     =    bspc
  tab       q    w    e    r    t    y    u    i    o    p    [     ]    \
  caps  a    s    d    f    g    h    j    k    l    ;    '          ret
  lsft z    x    c    v    b    n    m    ,    .    /                    rsft
  wkup lctl lalt super        spc            super lalt  rctl    pgdn up   pgup
                                                                         left down rght
)

Have you tried sys instead of prnt ? That's what my keyboard PrntScr key outputs.

Thanks @entibo this worked for me

Thanks @entibo worked for me too!!! Closing issue now