#voice-chat-text-0

1 messages Β· Page 340 of 1

vocal basin
#

to compare them

#
File Type: DLL

  Image has the following dependencies:

    api-ms-win-core-synch-l1-2-0.dll
    kernel32.dll
    ntdll.dll
    python311.dll
    VCRUNTIME140.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
#

also VCRUNTIME140_1.dll is there

#

whatever that is

#

hmm

#

they're depending on different python dlls

frozen owl
#

wait is there like a pip but for this stuff?

vocal basin
#

what does Cargo.toml section for pyo3 currenlty look like?

#

in tz_rust

frozen owl
#
[package]
name = "tz_rust"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "tz_rust"
crate-type = ["cdylib", "rlib"]

[dependencies.pyo3]
version = "0.22.2"
features = ["extension-module", "auto-initialize", "abi"]

# [tool.maturin]
# python-source = "python"

[profile.release]
debug = true
vocal basin
#

remove features from there

#

all three

#

check all dlls from the list

frozen owl
#

it looks different from this

#
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing tz_rust: The specified module could not be found.
frozen owl
#

like check if they exist on my computer?

vocal basin
#

the same way you found these

frozen owl
#

ah

vocal basin
#

wherever you're running the thing on

#

VCRUNTIME140_1.dll is suspicious

frozen owl
#

yeah

#

_1

#

but they all exist

vocal basin
#

okay so need to check the path then

frozen owl
#

shit

vocal basin
#

$env:PATH should contain that LLVM directory

frozen owl
#

i really dont want to do anything with path tbh, im so scared of wiping everyshit

#
C:\Program Files\LLVM\bin
#

do you think its bc of my file structure

#

here

vocal basin
#

there's a random suggestion on stackoverflow, but sounds a bit suspicious too

pip install msvc-runtime
frozen owl
#

well do i have to start over for maturin

#

like init doesnt really quite work?

#

damn, trace seems to be the default here

#

like a fuckton of messages

vocal basin
#

can you comment out as much as possible leaving basically just an empty Python module export?

frozen owl
#

with python -v

>>> import tz_rust
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 676, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 573, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1233, in create_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: DLL load failed while importing tz_rust: The specified module could not be found.
frozen owl
#

like tz_rust needs deps

vocal basin
#

in same project

#

just comment out dependencies and modules

#

except for pyo3

#

yeah, comment out the code too

#

no need to comment inside nested

#

what else is there in Cargo.toml?

frozen owl
#

all that's left

[package]
name = "tz_rust"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "tz_rust"
crate-type = ["cdylib", "rlib"]

[dependencies.pyo3]
version = "0.22.2"
# features = ["extension-module", "auto-initialize", "abi"]

# [tool.maturin]
# python-source = "python"

[profile.release]
debug = true
vocal basin
#

so something like is wrong with venv

frozen owl
#

like now the traceback is just

>>> import tz_rust
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing tz_rust: The specified module could not be found.
frozen owl
#

like i told you, for this project i just did maturin develop

#

like no init

#

is there a way to restart

vocal basin
#

remake the venv, without system packages enabled

frozen owl
#

ye venv is a lil messed up

vocal basin
frozen owl
#

maturin develop?

#

no init?

#

⚠️ Warning: Couldn't find the symbol PyInit_tz_rust in the native library. Python will fail to import this module. If you're using pyo3, check that #[pymodule] uses tz_rust as module name

vocal basin
#

@frozen owl uncomment the pymodule part, yes

#

and mod containing it

frozen owl
#

πŸ¦€

vocal basin
#

it still shows the warning?

frozen owl
#

yeah

#

do i have to re init maturin

vocal basin
#

idk what else could be broken there

frozen owl
#

pls can you help me test the code, ive sent you the files alr

vocal basin
#

trying

frozen owl
#

like a dummy build

#

ty :D

vocal basin
#
[build-system]
requires = ["maturin>=1.7,<2.0"]
build-backend = "maturin"

[project]
name = "tz_rust"
requires-python = ">=3.8"
dynamic = ["version"]

[tool.maturin]
features = ["pyo3/extension-module"]
frozen owl
#

nop

#

maturin is indeed 1.7.0

#

still no

vocal basin
#

remove everything venv-related

frozen owl
#

hm?

vocal basin
#

also from the . venv run

#

./Scripts
./lib
./include

#

and whatever else

#

oh it's different lib

#

hmm

#

can you show what subdirectories lib has, again?

#

remove site-packages

#

then

#

./pyvenv.cfg

#

delete that one too

#

now create the venv again

#

pip install maturin

frozen owl
#

?

#

like reinstall?

vocal basin
#

inside venv

frozen owl
#

but i didnt need to?

#

still no

#

i tried to install inside venv

#

and then rebuilt

#

still no

vocal basin
#

given that it worked for you on the same machine but for a different project shows that's something project-specific is happening

frozen owl
#

like folder specific?

#

like i mean ive sent you the code alr

#

and it worked for you

vocal basin
#

I ran that on Linux

#

you should try running the thing in that test project

#

should be src

#

@frozen owl cargo.toml

#

you're not building --release

#

@frozen owl as in that's why that section doesn't matter

#

just copy the other cargo.toml into there

#

and pyproject.toml

#

classifiers is just tags for searching PyPI

frozen owl
#

maturin develop --release

vocal basin
#

@frozen owl try using a different project name

#

@frozen owl in lib.rs too if you have the name there

#

and stop doing --release

#

you don't need --release

frozen owl
#
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\andre\RemoteFolder\.venv\Lib\site-packages\tz\__init__.py", line 1, in <module>
    from .tz import *
ImportError: dynamic module does not define module export function (PyInit_tz)
frozen owl
#

VERY STRANGE

vocal basin
#

so for whatever reason tz_rust.tz_rust is broken system-wise

#

well you always have the option to drop the _

#

with everything uncommented?

frozen owl
#

now trying with everything uncommmented

#

like everything

#

it worked with the minimal build in the original folder

vocal basin
#

now you need to register all types you want to construct from Python

#

.add_class::<MessageType>()

frozen owl
#

this applies for enums too right?

#

do i have to register the enum variants?

vocal basin
#

cfg in venv

#

you also uncommented stuff

#

iirc

#

try undoing the cfg change

frozen owl
#

ugh this trace thing is just like annoying

#

like i changed to info earlier

#

nop

vocal basin
#

it might be expecting pip dependencies to be in-venv

frozen owl
#

?

#

wdym

#

like do i install pytorch inside the venv?

#

πŸ’€

#

bye 2.6GB

#

alright it's worth a try

vocal basin
#

just removing, then recreating the .venv directory should be enough

#

and now you need to install into venv

frozen owl
#

ohshit

#

🫑

vocal basin
#

@frozen owl without everything starting with +

#

+cu... is build metadata

#

afaik

#

!semver

#

r

#

@frozen owl what was the suffix again?

#

you need specific --index-url allegedly

frozen owl
#

torch==2.1.0+cu121

vocal basin
#

pip install torch --index-url https://download.pytorch.org/whl/cu121

primal shadow
vocal basin
#

modern macs fundamentally can't support cuda

#

afaik

#

aren't they integrated only?

primal shadow
vocal basin
frozen owl
#

it says stable 2.4

#

i want 2.1

#

specifically

primal shadow
vocal basin
#

@cerulean jungle pip freeze doesn't include index urls

#

eh

#

no

#

that's why

#

that's why you shoudn't pip freeze

#

install from [not PyPI]

frozen owl
#

i probs will just do a custom install stuff, like not include pytorch in requirements.txt

vocal basin
frozen owl
#

and seperately install in a build script

vocal basin
#

write requirements.txt manually so that it actually works at all

frozen owl
#

massive oof for my slow wifi

(.venv) PS C:\Users\andre\RemoteFolder\ZanLing-TrueZero> pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
Looking in indexes: https://download.pytorch.org/whl/cu121, https://pypi.ngc.nvidia.com
Collecting torch==2.1.0
  Downloading https://download.pytorch.org/whl/cu121/torch-2.1.0%2Bcu121-cp311-cp311-win_amd64.whl (2473.9 MB)
     ━━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.6/2.5 GB 3.1 MB/s eta 0:10:05
#

rip

#

sorry alisa this is a shitter wifi that im using

#

imagine if this is the wrong version

#

like it's not even my current wifi that im installing it on

vocal basin
#

if you're brave enough you can use pip for anything

frozen owl
#

me fr

#

i dont use conda

#

that might be a problem

#

docker time

vocal basin
#

you can mount source volumes into the container

#

or just develop inside the container

#

I used to have to wait 30 minutes for one of my projects to compile
on each push

#

so 10 minutes once a few days isn't that bad

vocal basin
#

move large stable common layers towards the start

#

and stuff you change often towards the end

vocal basin
#

just a directory

#

the way it's usually done is:
copy requirements.txt
install
copy source

#

only rebuilds the whole thing when dependencies change

#
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY src src
frozen owl
#

my current dockerfile @vocal basin

# Use the official Ubuntu base image
FROM ubuntu:latest

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app

# Update package lists and install necessary dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-dev \
    python3.10-venv \
    build-essential \
    curl \
    libglib2.0-0 \
    libgl1 \
    protobuf-compiler \
    pkg-config \
    libssl-dev \
    libclang-dev \
    clang \
    nano \
    && apt-get clean \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

ENV PATH="/root/.cargo/bin:${PATH}"

ENV LIBTORCH_USE_PYTORCH=1
ENV LIBTORCH_BYPASS_VERSION_CHECK=1

RUN apt-get update && apt-get install -y git \
    && git clone https://github.com/andreaslam/ZanLing-TrueZero /app

RUN pip3 install -r /app/requirements.txt

WORKDIR /app
RUN git pull
CMD [ "cargo", "build","--release" ]
vocal basin
#

we still don't know what specific dll causes that

#

is LIBTORCH_USE_PYTORCH=1 enabled currently?

fierce stratus
#

I have question about FastAPI authentication. When trying to login, is it enough to get token code for backend part?
because I have this func

  
@app.post("/token", response_model=Token)
async def login_for_access_token(
    form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
    db: Session = Depends(get_db)
):
    
    user = authenticate_user(db, form_data.username, form_data.password)
    print(user.username)
    if not user:
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Incorrect username or password",
            headers={"WWW-Authenticate": "Bearer"},
        )
    access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
    access_token = create_access_token(
        data={"sub":user.username}, expires_delta=access_token_expires
    )
    return Token(access_token=access_token, token_type='bearer')

it returns me the token and token type which is fine, but when I send the request to to the endpoint that requires authentication, it returns "Not Authorized"
I am using fastapi OAuth2 dependency

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
vocal basin
#

how are you passing the token when making subsequent requests?

#

what what I remember about OAuth2, client does need to do some work

fierce stratus
vocal basin
frozen owl
vocal basin
#

if you comment back all the stuff in lib.rs/Cargo.toml, it works, right?

#

gradually uncomment

#

find out what exactly is broken

fierce stratus
vocal basin
frozen owl
#

it broke

#

shit

#

but at some point it did work

#

in the same folder

vocal basin
#

autosave delay

#

so now you need find what exact dependency causes that issue

fierce stratus
#

when I were to authorize using green botton in swagger gui, it authorizes me fine, and the endpoints work fine, but not with the endpoint that returns the token

vocal basin
frozen owl
#

everything worked with uncommented

#

live on stream

fierce stratus
vocal basin
vocal basin
vocal basin
frozen owl
#

cargo vendor?

vocal basin
#

no

vocal basin
#

there are different names

#

as an example

frozen owl
#

unstable

vocal basin
#

also I need to go now

frozen owl
#

none

frozen owl
#

but i couldnt find any

slate viper
#

What yea tryna do ?

#

yea I keep on leaving and joining the server

fierce stratus
#

how do you get permission to share a screen?

slate viper
lost bluff
#

why cant i talk

#

is it only me?

#

no voice permission>?

#

<@&831776746206265384> ?

peak siren
#

!voice

wise cargoBOT
#
Voice verification

Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

lost bluff
#

ty

peak siren
lost bluff
uncut lynx
#

Howdy

#

Not much. Just checking if anything was going on in vc

#

How about 6 or 7 half finished projects lol

#

Exactly

#

Frfr

#

Right now, I’m working on a compiler, but I’m stuck with the ir translation

#

Well, two projects, one was my own programming language, and I started a brainf*** compiler so I could learn how the compiler works

#

It’s a bit of a mix of paradigms borrowed from rust, lisp and a few others

#

Nyet

#

Yes

#

Also yes

#

It’s the answer to the question: who should use it?

#

Err, yes

#
    I'm a block comment

    # I support markdown

    no
    (out "Hello world")


    py
    print("Hello World")

|#
;;;; file level comments are denoted with four
;;; block comments denoted with three
;; section descriptions denoted with two
; single line comments denoted with one

;;;; main.no

;;; all expressions are denoted via S-expressions

(fn functin_name (arg1, arg2, arg3)
    (return (thing_to_return))
)
;;; ie

;;; optional explicit return type
(fn sum:int (arg1, arg2, arg3) (return (+ arg1, arg2, arg3)))

;;; if statement has NO else if; all if statements should be designed as ternary, the if_false should use pass to indicate nothing happens 
(if (cond) (if_true) (if_false))

;;; ie
(if (== 1 1) (out "Hello World") (pass))
;;; Variable assignment with type inference
(let var_name 1.0)

;;; Variable assignment with explicit type

(let var_name:float 1.0)
(let count:int 42)
(let message:string "Hello, world!")
(let pi:double 3.14159)

;;; If statement with a string

(if (== 1 1) (out "Hello World") (pass))
``` This is what it looks like so far
#

@wind raptor ^

#

yes

spare galleon
#

what language?

uncut lynx
spare galleon
#

does it do smth cool?

uncut lynx
#

it's fun to build

spare galleon
#

yeh but does it have a neat feature?

uncut lynx
uncut lynx
spare galleon
#

i like Django

spare galleon
uncut lynx
#

I'm more of a flask guy myself

uncut lynx
spare galleon
#

@wind raptor i am used to that, i mainly work in ROR

spare galleon
uncut lynx
spare galleon
#

lol i meant to say openXR

#

lol i luv bun

#

bun is fun

#

native typescript goes hard

#

whats the advent of code role?

uncut lynx
#

be pretty hard lol

spare galleon
#

@wind raptor west or east coast?

#

ohhh cool sudbury?

uncut lynx
#
def multi_numeric_input(*args: str) -> tuple[float, ...]:
    while True:
        try:
            x = ()
            for i in args:
                query, case = query_hist(input(f"Enter value for {i}: "))
                if query:
                    x += (float(case),)
                else:
                    raise ValueError(case)
            return x
        except ValueError as e:
            print('Bad Value, try again')
            print(e)

spare galleon
#

why did everyone die

fierce stratus
#
@app.post("/token", response_model=Token)
async def login_for_access_token(
    form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
    db: Session = Depends(get_db)
):
    
    user = authenticate_user(db, form_data.username, form_data.password)
    if not user:
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Incorrect username or password",
            headers={"WWW-Authenticate": "Bearer"},
        )
    access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
    access_token = create_access_token(
        data={"sub":user.username}, expires_delta=access_token_expires
    )
    return Token(access_token=access_token, token_type='bearer')

@app.get("/user/me")
async def read_user_me(
    current_user: Annotated[User, Depends(get_current_active_user)]
):
    return current_user
wind raptor
#

!stream 950814388854616074

wise cargoBOT
#

βœ… @fierce stratus can now stream until <t:1723160642:f>.

spare galleon
#

also may i get help with my piece movement function

#

its so bad

#

i fix my pawns

#

now my knights are broken

#

wtf

wind raptor
spare galleon
#

i fix my knights but now my black pawns dont work

#

this is so stupid

#
 delta_row = abs(row_end - row_start)
 delta_col = abs(col_end - col_start)```
these 2 pieces of code rlly be screwing with me
#

@wind raptor i have some great repos for you if you want to build a docker

wind raptor
#

Bye @tawdry hollow πŸ‘‹

spare galleon
#
        row_start, col_start = start
        row_end, col_end = end

        delta_row = abs(row_end - row_start)
        delta_col = abs(col_end - col_start)

        piece_type = piece.lower()
        piece_color = self.get_color(piece)
        target_piece = self.positions.get(end)

        # Debugging outputs
        print(f"Start: {start}, End: {end}, Piece: {piece}, Target: {target_piece}")

        if target_piece and self.get_color(target_piece) == piece_color:
            print("Move blocked: destination occupied by same color")
            return False

        if piece_type == 'p':  # Pawn
            forward = 1 if piece_color == 'white' else -1
            start_row = 1 if piece_color == 'white' else 6

            if delta_row == delta_col and delta_col == 0 and target_piece is None:
                return self.is_path_clear(start, end)
            if delta_row == 2 * forward and delta_col == 0 and row_start == start_row and target_piece is None:
                return self.is_path_clear(start, end)
            if delta_row == forward and delta_col == 1 and target_piece:
                return self.is_path_clear(start, end)
            print("Pawn move failed due to incorrect movement or blocked path")

# why is this chunk of code so annoying
# also got to update the logic for fenstrings but thats handles seperatly rn```
#

i stripped edge cases still cant get black pawns to move, this is old code, (as in the an passant is not exist in my code)

#

well i removed to debug

#

wait i broke it more, give me a sec, to get it back to a reasonable state

#

all the pieces have logic rn

#

yeh i can, give me 1 minute i will get back to you, i am refactoring the logic

#

i can move any black piece, i just cant move black pawns

#

and now i cant move white pawns

#

i am totally rewriting the code, give me minute

#

no its a problem in how i handle my delta_row and delta_col

#

because its abs

#

idk

#
if piece_type == 'p':  # Pawn
            direction = 1 if piece_color == 'black' else -1

        if delta_col == 0:
            if delta_row == direction and target_piece is None:
                return True
            if delta_row == 2 * direction and row_start in (1, 6) and target_piece is None:
                intermediate_square = (row_start + direction, col_start)
                if self.positions.get(intermediate_square) is None:
                    return True```
#

updated pawn logic

#

i use a fen string

#
    def set_from_fen(self, fen):
        self.positions.clear()
        parts = fen.split()
        pieces_placement = parts[0]
        row_index = 7 
        col_index = 0  
        for char in pieces_placement:
            if char == '/':
                row_index -= 1
                col_index = 0
            elif char.isdigit():
                col_index += int(char)
            else:
                self.positions[(row_index, col_index)] = char
                col_index += 1```
#
    def move_piece(self, start_pos, end_pos):
        if start_pos in self.positions:
            piece = self.positions[start_pos]
            if self.is_legal_move(piece, start_pos, end_pos):
                captured_piece = self.positions.pop(start_pos)
                self.positions[end_pos] = captured_piece
                self.last_move = {'piece': captured_piece, 'start': start_pos, 'end': end_pos}

                print(f"Moved {piece} from {start_pos} to {end_pos}")
                print("Updated FEN:", self.generate_fen())
                return True
            else:
                print(f"Illegal move for {piece} from {start_pos} to {end_pos}")
        else:
            print(f"No piece at starting position {start_pos}")
        return False```
and this is how i handle move logic
#

somehow deleted the pawn code, and ran it with no pawn logic

spare galleon
#

my problem is just with checking legal moves

#
def is_legal_move(self, piece, start, end):


        row_start, col_start = start
        row_end, col_end = end

        delta_row = abs(row_end - row_start)
        delta_col = abs(col_end - col_start)

        piece_type = piece.lower()
        piece_color = self.get_color(piece)
        target_piece = self.positions.get(end)

        # Debugging outputs
        print(f"Start: {start}, End: {end}, Piece: {piece}, Target: {target_piece}")

        if target_piece and self.get_color(target_piece) == piece_color:
            print("Move blocked: destination occupied by same color")
            return False

        if piece_type == 'p':  # Pawn
            direction = 1 if piece_color == 'black' else -1  # Direction depends on the color of the pawn

        if delta_col == 0:
            if delta_row == direction and target_piece is None:
                return True
            if delta_row == 2 * direction and row_start in (1, 6) and target_piece is None:
                intermediate_square = (row_start + direction, col_start)
                if self.positions.get(intermediate_square) is None:
                    return True```
uncut lynx
#

45bb3d34-7cd4-495a-a9e0-fd8f5d737a4d

spare galleon
#

anyway thanks for the help

#

ik im hard to help because im so adhd

hoary gyro
spare galleon
#

yeh both sides are now bad, dont know why

#
Moved N from (0, 6) to (2, 5)
Updated FEN: 8/nbqkbnr1/ppppppp1/8/8/8/4N3/PPPPPPP1
Start: (7, 1), End: (5, 2), Piece: n, Target: None
Moved n from (7, 1) to (5, 2)
Updated FEN: 8/1bqkbnr1/ppppppp1/1n6/8/8/4N3/PPPPPPP1
Start: (1, 3), End: (3, 3), Piece: P, Target: None
Illegal move for P from (1, 3) to (3, 3)
Start: (6, 3), End: (4, 3), Piece: p, Target: None
Illegal move for p from (6, 3) to (4, 3)```
#

wait i didnt indent:faceslap:

#

nvm that didnt fix

#

yeh just now

#

repeat? i was reading code

#

i have logic for that, i believe, if i dont, that can be worked on once i get the pieces to move, because you cant have capture if the pieces cant move ami right

#

i need the abs, because then it dont need to do as much work in my other pieces

#
            if (delta_row, delta_col) in [(2, 1), (1, 2)]:
                return True
            print("Knight move failed due to incorrect L-shape")

        elif piece_type == 'r':  # Rook
            if delta_row == 0 or delta_col == 0:
                return self.is_path_clear(start, end)
            print("Rook move failed due to non-straight path")

        elif piece_type == 'b':  # Bishop
            if delta_row == delta_col:
                return self.is_path_clear(start, end)
            print("Bishop move failed due to non-diagonal path")

        elif piece_type == 'q':  # Queen
            if delta_row == delta_col or delta_row == 0 or delta_col == 0:
                return self.is_path_clear(start, end)
            print("Queen move failed due to incorrect path")

        elif piece_type == 'k':  # King```
#

yeh for pawns its not needed

#

however i dont mind if pawns move backwards rn

#

maybe thats the problem

#

it thinks it can only move in the wrong direction

#

lol nah cant be, it would think it can move bothways

#

but i will try it without

#

hmmm that didnt work

#

yeh

#

still not working

#

ohh well time to rewrite the entire program

#

lol

#

but actaully it is so bad

#

ima remove the checks

#

yeh ik, anyway

#

ima call it a night

uncut lynx
#

bfd6247b-e523-4d19-9765-8a3763646521

spare galleon
uncut lynx
#
import uuid

from flask import Flask, abort, jsonify, render_template, request
from flask_cors import CORS
from flask_socketio import SocketIO, emit, join_room

app = Flask(__name__)
CORS(app)
socketio = SocketIO(app)

# In-memory storage for chat messages
chatrooms = {}

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/room/<code>', methods=['GET'])
def chatroom(code):
    if code not in chatrooms:
        return abort(404, description="Chatroom not found")
    return render_template('chatroom.html', code=code)

@app.route('/api/room/<code>/messages', methods=['GET', 'POST'])
def messages(code):
    if code not in chatrooms:
        return abort(404, description="Chatroom not found")

    if request.method == 'POST':
        data = request.json
        username = data['username']
        message = data['message']
        chatrooms[code].append((username, message))
        socketio.emit('new_message', {'username': username, 'message': message}, room=code)
        return jsonify({'status': 'Message sent'}), 201

    return jsonify(chatrooms[code])

@app.route('/create_room', methods=['POST'])
def create_room():
    code = str(uuid.uuid4())
    chatrooms[code] = []
    return jsonify({'code': code})

@socketio.on('join')
def on_join(data):
    code = data['code']
    username = data['username']
    if code in chatrooms:
        join_room(code)
        join_message = f"{username} has joined the chat"
        chatrooms[code].append(('System', join_message))
        socketio.emit('new_message', {'username': 'System', 'message': join_message}, room=code)

if __name__ == '__main__':
    socketio.run(app, '0.0.0.0', port=80, allow_unsafe_werkzeug=True, debug=True)
hoary gyro
#
ΰΉ‡ΰΉ‡ΰΉ‡ ΰΉ‡ΰΉ‡ΰΉ‡
ΰΉ‡ΰΉ‡ΰΉ‡
ΰΉ‡ΰΉ‡
#

@solid merlin ask your question here

uncut lynx
#

bbffdc7b-9a97-45bb-91ca-ceb9b0416615

#

8abbd110-7eca-4b54-9012-1f3ebea4baae

spare galleon
#

// Chatroom and username setup
const chatroomCode = 'bbffdc7b-9a97-45bb-91ca-ceb9b0416615';
const username = 'system';

socket.emit('join', { code: chatroomCode, username: username });

const message = 'can I type as system';
socket.emit('new_message', { username: username, message: message });

// Listen for new messages
socket.on('new_message', function(data) {
    console.log(data.username + ': ' + data.message);
});```
uncut lynx
#
document.addEventListener('DOMContentLoaded', () => {
            const username = localStorage.getItem('username');
            if (!username) {
                alert('No username found in localStorage. Please set your username before joining a chatroom.');
                window.location.href = '/'; // Redirect to a suitable page if username is missing
                return;
            }

            // Emit join event with username
            socket.emit('join', { code: code, username: username });

            // Send join message to the chatroom
            const joinMessage = `${username} has joined the chat`;
            socket.emit('new_message', { code: code, username: 'System', message: joinMessage });

            // Fetch and display existing messages
            fetch(`/api/room/${code}/messages`)
                .then(response => response.json())
                .then(messages => {
                    const chat = document.getElementById('chat');
                    messages.forEach(msg => {
                        const p = document.createElement('p');
                        p.innerHTML = `<strong>${msg[0]}</strong>: ${msg[1]}`;
                        chat.appendChild(p);
                    });
                });

spare galleon
#

8eabd400-f8f8-4ff8-945d-2c9a472f94f8-00-197i1fc9ssahk.kirk.replit.dev

uncut lynx
#

8abbd110-7eca-4b54-9012-1f3ebea4baae

wind raptor
#

b2f7d29e-34e8-4c28-8c40-59be175c470e

spare galleon
spare galleon
wind raptor
#

Bye @spare galleon

#

<button>Not a thing here</button>

spare galleon
#

altho im not sure

#

could be related to smgh else

uncut lynx
#

e7d13602-e669-49e9-9a96-b0b6292e1ff2

uncut lynx
wind raptor
fierce stratus
desert vector
#

.topic

viscid lagoonBOT
#
**Name one famous person you would like to have at your easter dinner.**

Suggest more topics here!

desert vector
#

!ban 1185198330314248234 racism

wise cargoBOT
#

:incoming_envelope: :ok_hand: applied ban to @mortal steeple permanently.

fierce stratus
#

lol

desert vector
fierce stratus
#

did not we suppose to educate him?

#

@desert vector Elon Musk?

#

no?

#

ok ok)

somber heath
#

@robust oasis πŸ‘‹

robust oasis
#

πŸ‘

somber heath
#

@shut python πŸ‘‹

robust oasis
#

There is no question.

#

Sounds like a pain to run unit tests on.

#

Lol

#

Haha. Test my code? Why?

fierce stratus
#

writing my tests rn

robust oasis
#

Next time ask them what a unit test is.

#

You're hired!

fierce stratus
#

web socket?

robust oasis
#

Never heard of it

desert vector
nova prawn
#

hey did any one have done spam detection system ML project thesis

desert vector
#

!e

operation_dict = {"add": lambda x, y: x + y}

op = "add"
print(operation_dict[op](1, 1))
wise cargoBOT
nova prawn
#

if yess i need one

upper basin
#

Hello Osyra

foggy field
#

hi

#

shouldn't you use match and case in place of if ladders?

robust oasis
#

I think I've seen something similar to match case in Dart or Kotlin. I didn't realize Python had it until just now. There are some good use cases.

desert vector
#

!e

from operator import add, truediv, mul, sub
operation_dict = {"add": add, "divide": truediv, "multiply": mul, "subtract": sub}

print(operation_dict["add"](4, 2))
print(operation_dict["divide"](4, 2))
print(operation_dict["multiply"](4, 2))
print(operation_dict["subtract"](4, 2))
wise cargoBOT
robust oasis
#

Lol. Just don't type hint. Only in Python

desert vector
#
@deco
def f():
  pass
foggy field
#

where is the code they are talking about?

somber heath
#

A fireworks project I did ended up looking likepy @b @c @d class E(A): pass

desert vector
#

!e

def timer(func):
  import time
  def inner(*args, **kwargs):
    t0 = time.perf_counter()
    result = func(*args, **kwargs)
    print(f"finished in {time.perf_counter() - t0}s")
    return result
  return inner

@timer
def fib(n):
  a, b = 0, 1
  while a < n:
    print(a)
    a, b = b, a + b

fib(10)
wise cargoBOT
robust oasis
#

Just don't type hint. It's more Pythonic

foggy field
#

πŸ™‚

#

ah it changes my text

somber heath
#

Type hinting for programmers is like millet seed for vampires.

foggy field
#

forgot to turn that off

#

is it off now? :)

#

yay!

fierce stratus
#
def test_sign_up():
    username = generate_random_string()
    password = generate_random_string()

    response = client.post(
        "/users/",
        json={"username": username, "password": password}
    )
    
    assert response.status_code == 200
    assert response.json() == {
        "username": username,
        "disabled": False,
        "full_name": None,
        "id": response.json().get("id"),
        "tasks": []
    }

I have FasrAPI backend, and when I run this test, it send request to and the user really been created in DB, is it normal behavior for fastapi TestClient?

foggy field
#

Isn't any() to identify iterables

upper basin
#

@severe nebula Please message here, and you need to wait for voice verification criteria to be met.

upper basin
severe nebula
#

I just wanna chat in the voice chat 😦

foggy field
#

oh

severe nebula
#

my apologies

upper basin
#

@somber heath can you please explain it to Trial and Mostly Errors?

severe nebula
#

I am just learning python in Azure Functions. And I've done a lot in this space only find out I have dug myself into a hole

#

and I'm very bummed

foggy field
upper basin
#

If you have a question, please type it here in the meantime.

severe nebula
#

if Azure isn't the move what makes sense to pivot to?

somber heath
#

Programmers not liking SOAP.

upper basin
#

"Foap!!"

#

"No no no Foap!"

#

Iykyk

desert vector
#

.xkcd 927

viscid lagoonBOT
#

Fortunately, the charging one has been solved now that we've all standardized on mini-USB. Or is it micro-USB? Shit.

severe nebula
#

I have a lot of questions to ask in the voice channel and I cannot

#

I don't want to spam here but how can I make this happen? lol

foggy field
#

python 2030: has 50 different standards

#

bruh

#

yes both are large

#

for instance bc vs ny

robust oasis
#

Yes there are different time zones in US and Canada. I'm going to bed too. Later.

somber heath
#

@vernal apex πŸ‘‹

wind raptor
#

Not really...

foggy field
#

what games?

#

Im moving to bc in ~20 days

foggy field
#

goodnight

#

im not going tho

#

how have I not sent 50 messages, I have been on this server for months

#

are there any other python discords that are more international so more people are awake at any time?

#

my sleep schedule is trash so thats why

gentle flint
gentle flint
cunning burrow
#

Hello everyone, can someone help me with my docker shouting on psycopg ?

vocal basin
#

I found another weird CI thing to figure out

#

sccache inside docker build inside Actions

#

@wind raptor do you use sccache?

primal shadow
#

Did not know NE was not on EST/EDT

vocal basin
wind raptor
wind raptor
#

Can you explain?

vocal basin
#

caching for C/C++/Rust

#

works both locally and in CI

#

@frozen owl so it works with dependencies but without modules, right?

frozen owl
#

yes

wind raptor
vocal basin
#

figure out what specific module causes the error

frozen owl
#
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tzrust
# C:\Users\andre\RemoteFolder\ZanLing-TrueZero\.venv\Lib\site-packages\tzrust\__pycache__\__init__.cpython-311.pyc matches C:\Users\andre\RemoteFolder\ZanLing-TrueZero\.venv\Lib\site-packages\tzrust\__init__.py
# code object from 'C:\\Users\\andre\\RemoteFolder\\ZanLing-TrueZero\\.venv\\Lib\\site-packages\\tzrust\\__pycache__\\__init__.cpython-311.pyc'
# extension module 'tzrust.tzrust' loaded from 'C:\\Users\\andre\\RemoteFolder\\ZanLing-TrueZero\\.venv\\Lib\\site-packages\\tzrust\\tzrust.cp311-win_amd64.pyd'
# extension module 'tzrust.tzrust' executed from 'C:\\Users\\andre\\RemoteFolder\\ZanLing-TrueZero\\.venv\\Lib\\site-packages\\tzrust\\tzrust.cp311-win_amd64.pyd'
import 'tzrust.tzrust' # <_frozen_importlib_external.ExtensionFileLoader object at 0x000001AFECD30D10>
import 'tzrust' # <_frozen_importlib_external.SourceFileLoader object at 0x000001AFECAE7010>
vocal basin
frozen owl
vocal basin
#

@frozen owl how much of the modules can you uncomment without uncommenting all of them?

#

@frozen owl keep dependencies as is

#

gradually enable modules in your code

frozen owl
#

do you have checkpoints @upper basin

#

like you said you had to rerun

#

quite strange @vocal basin

#

all the calls for messagetype are from the bins

#

wait nvm

#

misread

vocal basin
#

as in?

upper basin
vocal basin
#

I use Linux servers for development

upper basin
#

You're training a model, it's a different thing.

frozen owl
#

wait alisa what are my options if i were to split my lib to another crate

#

this is maddening fr

vocal basin
#

and data on Windows PC

vocal basin
frozen owl
#

damn

vocal basin
#

issue is with missing DLL

#

or a mislinked one

frozen owl
#

or can i compare the one that worked vs the one that didnt?

#

i can send you my current successful build

vocal basin
#

you need to get the most of the library working

#

to find what DLL is causing the problem

#

or install dtrace and find out what exact DLL load fails

frozen owl
#

dtrace?

#

does it have a tui

vocal basin
#

dtrace is non-interactive CLI

frozen owl
#

ggs

vocal basin
#

I don't remember what probes correlate to DLL loading

#

also figure out why your RUST_LOG is at trace

frozen owl
#

no?

frozen owl
#

the current build is quite short?

#

ah

vocal basin
#

RUST_LOG normally is not defined

frozen owl
#

i have ran maturin before on this project

vocal basin
#

@midnight agate

frozen owl
#

so perhaps it has enabled it by default?

wind raptor
#

Hey @midnight agate πŸ‘‹

vocal basin
#

Forgejo getting something important that Gitea doesn't have

scarlet halo
vocal basin
frozen owl
#

@vocal basin i have ran maturin before on this project prior to last night

#

not sure if maturin has auto-configed my shit somehow using some setting

#

--verbose?

vocal basin
stiff sigil
#

just joined waht are yall working on tdy!

vocal basin
frozen owl
#

yeah i always run verbose if shit fucks up

vocal basin
#

yes

#

GitHub had it

#

Gitea didn't support it

#

still doesn't

#

it's separate from automated triggers

#

it doesn't "pretend" as if something automated was ran

frozen owl
#

hm, i think the best ive gone was to leave 3 files uncommented

#

still no

vocal basin
#

@frozen owl some of modules might be causing DLL linkage

frozen owl
#

i have a CModule item that im using in one of the files

#

that might be the sus??????????????????????????

#

like all the main code is gone, the only the "peripherial" code remains

frozen owl
#

FUCK

#

THAT IS THE MOST IMPORTANT SHIT IN MY FUCKING CODE

#

that contains the nn module

#

without that i cant do anyshit

vocal basin
frozen owl
#

wdym

vocal basin
#

how do you load it?

frozen owl
vocal basin
#

show where it's instantiated

frozen owl
#

ok im back

#

the code im using


pub struct Net {
    pub net: CModule,
    pub device: Device,
}

impl Net {
    /// creates a new `Net` instance by loading a model from the specified path
    pub fn new(path: &str) -> Self {
        maybe_init_cuda();
        let device = if has_cuda() {
            if Cuda::cudnn_is_available() {
                Cuda::cudnn_set_benchmark(true);
            }
            Device::Cuda(0)
        } else {
            Device::Cpu
        };

        let mut net = tch::CModule::load_on_device(path, device).expect("ERROR");
        net.set_eval();

        Self {
            net: net,
            device: device,
        }
    }
vocal basin
#

@frozen owl what's the value of path

frozen owl
#

but path is a huge env var right

vocal basin
#

in code

#

path not PATH

#

what is it

#

what do you pass to Net::new

#

value

frozen owl
#
r"chess_16x128_gen3634.pt".to_string()
vocal basin
frozen owl
#

C:\Users\andre\RemoteFolder\ZanLing-TrueZero\chess_16x128_gen3634.pt

#

but i call it in src/bin

#

not inside the troublesome src folder

#

like it doesnt compile the bin stuff in maturin

vocal basin
frozen owl
#

and that has NOTHING to do with the message stuff

vocal basin
#

so at least this CModule shouldn't be the reason

#

some other DLL is wrong

#

@frozen owl what causes the outer function to get called?

#

one that calls Net::new

#

run_uci is never called in things like #[ctor], right?

#

@frozen owl send the .pyds for largest that works and smallest that doesn't work

#

(works as in can be imported)

frozen owl
#

🫑

urban abyss
#

How would you efficiently process a few hundred JSON files? I have a metrics process outputting loads of data in multiple files that are to be publishing to according BigQuery tables. Is there a good tool for this?

vocal basin
#

@frozen owl
yes, in site-packages

#
File Type: DLL

  Image has the following dependencies:

    bcryptprimitives.dll
    api-ms-win-core-synch-l1-2-0.dll
    python311.dll
    KERNEL32.dll
    ntdll.dll
    VCRUNTIME140.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
#

somehow doesn't have the api-ms-win-crt-string-l1-1-0.dll that maturin init project had had

#

@frozen owl what does dataformat contain?

whole bear
#

what are yall making

vocal basin
#

context-switching between, like, 5 different things at least

wind raptor
vocal basin
#

@frozen owl we need to compare to minimal non-importable still

#

minimal that fails on import

#

pyd

frozen owl
#

i highly suspect the file that goes wrong has something to do with our good friend torch

vocal basin
vocal basin
#

very randomised work process lmao

frozen owl
#

and this worked on your pc right?

#

like you can import in py?

vocal basin
#

only listed DLLs it depends on

#

try importing

#

@frozen owl send the pyd

#

it might be just optimising away everything

vocal basin
#

@frozen owl is superluminal that weird profiler?

#

remove it

vocal basin
#

it was kind of a not so good library to begin with

#
File Type: DLL

  Image has the following dependencies:

    bcryptprimitives.dll
    api-ms-win-core-synch-l1-2-0.dll
    python311.dll
    kernel32.dll
    ntdll.dll
    torch_cuda.dll
    torch_cpu.dll
    c10.dll
    MSVCP140.dll
    VCRUNTIME140.dll
    VCRUNTIME140_1.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-utility-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-environment-l1-1-0.dll
    api-ms-win-crt-time-l1-1-0.dll
frozen owl
#

UWOT

#

DOS IT WORK

#

CAN YOU IMPORT IT

vocal basin
#

I won't be able to import, for different reasons

frozen owl
#

?

vocal basin
#

at least that I don't have torch

frozen owl
#

h

#

oh but

#

the non cuda version is not that big

vocal basin
#

try impoting on your machine

frozen owl
#

trust me

#

it does work

somber heath
#

Yes, because I'm an idiot.

frozen owl
#

you saw it

vocal basin
#

okay so start the process of removing superluminal

#

also

#

it's not a free tool

#

just use cargo-flamegraph

#

or whatever else

#

there's always and option to just use raw dtrace/tracing/perf

#

@frozen owl did you remove superluminal as a dependency?

frozen owl
#

not yet

#

will do rn

#

i think i sorta lost track at some point

#

i think for the same combo it used to compile even after clean

#

but i shouldve kept a log of all that

#

🀦

frozen owl
vocal basin
#

if superluminal is messing with build, could be because of it

#

(thus requiring clean)

#

@frozen owl are you re-ran cargo clean, right?

#

brb

frozen owl
#

🀑 now even just message_types fuck up

#

what is wrong

#

🫠

#

(and im still in the venv)

vocal basin
frozen owl
vocal basin
#

so that section likely doesn't matter in this case

#
File Type: DLL

  Image has the following dependencies:

    bcryptprimitives.dll
    api-ms-win-core-synch-l1-2-0.dll
    python311.dll
    KERNEL32.dll
    ntdll.dll
    VCRUNTIME140.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
frozen owl
#

what if i create a dummy file with Net::new()

#

like i move the stuff away from the file and created a net struct

#

(smartest idea ive had all day?)

frozen owl
#

this is messed up

vocal basin
#

@frozen owl you ran cargo clean after purging all the superluminal-related code, right?

frozen owl
#

🫑

#

yes

vocal basin
#

get it back to the state when it had both torch dependency and could be imported

#

if that state even ever happened

frozen owl
#

h

frozen owl
#

🫑

frozen owl
#

unless the other files interfered with the setting as well which cancels out

vocal basin
#

maybe just do everything torch-related on Python's side

frozen owl
#

then would i face similar problems doing the opposite

#

like pack some py stuff into rust

#

since iirc pytorch calls c++ stuff

open moth
frozen owl
#

like i was thinking of isolating the message structs from everything else

#

🫠

#

this is so ok

#

🫠

frozen owl
#

🫠

#

unless i write my own nn inference lib 🫠

#

cuda time

vocal basin
#

I still don't know why exactly the error is happening

frozen owl
#

"missing dll"

#

but they all exist on my disk

#

ive checked path for quite a few of them

#

like ive done where on the stuff alr

#

failed run verbose message

>>> import tzrust
# C:\Users\andre\RemoteFolder\ZanLing-TrueZero\.venv\Lib\site-packages\tzrust\__pycache__\__init__.cpython-311.pyc matches C:\Users\andre\RemoteFolder\ZanLing-TrueZero\.venv\Lib\site-packages\tzrust\__init__.py
# code object from 'C:\\Users\\andre\\RemoteFolder\\ZanLing-TrueZero\\.venv\\Lib\\site-packages\\tzrust\\__pycache__\\__init__.cpython-311.pyc'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\andre\RemoteFolder\ZanLing-TrueZero\.venv\Lib\site-packages\tzrust\__init__.py", line 1, in <module>
    from .tzrust import *
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 676, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 573, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1233, in create_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: DLL load failed while importing tzrust: The specified module could not be found.
#

success run verbose (only messagetype stuff)

Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tzrust
# C:\Users\andre\RemoteFolder\ZanLing-TrueZero\.venv\Lib\site-packages\tzrust\__pycache__\__init__.cpython-311.pyc matches C:\Users\andre\RemoteFolder\ZanLing-TrueZero\.venv\Lib\site-packages\tzrust\__init__.py
# code object from 'C:\\Users\\andre\\RemoteFolder\\ZanLing-TrueZero\\.venv\\Lib\\site-packages\\tzrust\\__pycache__\\__init__.cpython-311.pyc'
# extension module 'tzrust.tzrust' loaded from 'C:\\Users\\andre\\RemoteFolder\\ZanLing-TrueZero\\.venv\\Lib\\site-packages\\tzrust\\tzrust.cp311-win_amd64.pyd'
# extension module 'tzrust.tzrust' executed from 'C:\\Users\\andre\\RemoteFolder\\ZanLing-TrueZero\\.venv\\Lib\\site-packages\\tzrust\\tzrust.cp311-win_amd64.pyd'
import 'tzrust.tzrust' # <_frozen_importlib_external.ExtensionFileLoader object at 0x0000023F1F0E0950>
import 'tzrust' # <_frozen_importlib_external.SourceFileLoader object at 0x0000023F1EE96E90>
#

@worldly robin there's a convo in your bg

vocal basin
#

I need to go

frozen owl
#

🫑

#

ty for your help

obsidian dragon
fierce stratus
#

Hello

frozen owl
fierce stratus
#

393556ec-8f3f-4527-882c-fbc9967015c9

uncut lynx
#

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/room/<code>', methods=['GET'])
def chatroom(code):
    chatroom = Chatroom.query.get(code)  # Query the database for the chatroom
    if not chatroom:
        return abort(404, description="Chatroom not found")
    return render_template('chatroom.html', code=code)

#
db = SQLAlchemy(app)

class Chatroom(db.Model):
    id = db.Column(db.String, primary_key=True)
    messages = db.relationship('Message', backref='chatroom', lazy=True)

class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    chatroom_id = db.Column(
        db.String,
        db.ForeignKey('chatroom.id'),
        nullable=False)
    username = db.Column(db.String, nullable=False)
    content = db.Column(db.String, nullable=False)
    timestamp = db.Column(db.DateTime, default=datetime.utcnow())
upbeat bobcat
#

Is this code wrong?

#

No ig it is giving error when I do that

uncut lynx
#

"//"

upbeat bobcat
#

but still giving none for boht

#

both

fierce stratus
#
mid = int((low+high)/2))
#

what about this way?

upbeat bobcat
uncut lynx
#

or mid = (low+high) // 2

fierce stratus
#

yeah

upbeat bobcat
uncut lynx
#

gotcha

spare galleon
#
fetch('https://8eabd400-f8f8-4ff8-945d-2c9a472f94f8-00-197i1fc9ssahk.kirk.replit.dev/api/room/393556ec-8f3f-4527-882c-fbc9967015c9/messages', {
    method: 'GET',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    }
})
.then(response => {
    if (!response.ok) {
        throw new Error('Network response was not ok');
    }
    return response.json();
})
.then(data => {
    console.log('Messages:', data);
})
.catch(error => {
    console.error('There was a problem with the fetch operation:', error);
});


fetch('https://8eabd400-f8f8-4ff8-945d-2c9a472f94f8-00-197i1fc9ssahk.kirk.replit.dev/api/room/393556ec-8f3f-4527-882c-fbc9967015c9/messages', {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        username: 'System',
        content: 'testing'
    })
})
.then(response => {
    if (!response.ok) {
        throw new Error('Network response was not ok');
    }
    return response.json();
})
.then(data => {
    console.log('Message created:', data);
})
.catch(error => {
    console.error('There was a problem with the fetch operation:', error);
});
#

@uncut lynx here is the code

jovial iris
#

floorp or firefox ? performance is the priority over functionalities. what would you choose ?

uncut lynx
#
Traceback (most recent call last):
  File "/home/runner/TestyDownrightIntelligence/.pythonlibs/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/runner/TestyDownrightIntelligence/.pythonlibs/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/runner/TestyDownrightIntelligence/.pythonlibs/lib/python3.10/site-packages/flask_cors/extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/runner/TestyDownrightIntelligence/.pythonlibs/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/runner/TestyDownrightIntelligence/.pythonlibs/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/home/runner/TestyDownrightIntelligence/main.py", line 99, in messages
    return jsonify(chatrooms[code])
NameError: name 'chatrooms' is not defined
#
if request.method == 'POST':
        data = request.json
        username = sanitize_input(data.get('username', DEFAULT_USERNAME))
        message = sanitize_input(data.get('message', ''))

        # Validate input lengths
        if len(username) == 0 or len(username) > MAX_USERNAME_LENGTH:
            username = DEFAULT_USERNAME  # Fallback to default username
        if len(message) == 0 or len(message) > MAX_MESSAGE_LENGTH:
            return jsonify({'error': f'Message must be between 1 and {MAX_MESSAGE_LENGTH} characters'}), 400```
spare galleon
#
fetch('https://8eabd400-f8f8-4ff8-945d-2c9a472f94f8-00-197i1fc9ssahk.kirk.replit.dev/api/room/393556ec-8f3f-4527-882c-fbc9967015c9/messages', {
    method: 'GET',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    }
})
.then(response => {
    console.log('Response status:', response.status);
    if (!response.ok) {
        return response.text().then(text => {
            throw new Error(`Network response was not ok: ${text}`);
        });
    }
    return response.json();
})
.then(data => {
    console.log('Messages:', data);
})
.catch(error => {
    console.error('There was a problem with the fetch operation:', error);
});

fetch('https://8eabd400-f8f8-4ff8-945d-2c9a472f94f8-00-197i1fc9ssahk.kirk.replit.dev/api/room/393556ec-8f3f-4527-882c-fbc9967015c9/messages', {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        username: 'System',
        content: 'Test.'
    })
})
.then(response => {
    console.log('Response status:', response.status);
    if (!response.ok) {
        return response.text().then(text => {
            throw new Error(`Network response was not ok: ${text}`);
        });
    }
    return response.json();
})
.then(data => {
    console.log('Message created:', data);
})
.catch(error => {
    console.error('There was a problem with the fetch operation:', error);
});
```here is the code im sending "test" dont know why im running into a character limit
uncut lynx
#

393556ec-8f3f-4527-882c-fbc9967015c9

uncut lynx
#

Yes

#

It’s nice for when I want to allow other people to test things without having access to my pc

somber heath
#

Things seem okay on my end.

#

We need another person to cross check.

wind raptor
#

I hear you

#

It's my mic 100%

#

Trying to get it working

#

PTT

#

I haven't used it all day.

#

Wired

#

I double checked the cables already

#

I may need to restart

#

RIP

somber heath
#

@honest isle πŸ‘‹

wind raptor
#

Well I guess I'm not on mic today haha

#

I think it is the mic itself

#

I'll have to find another to test that though

#

I tried most system things

#

I know a few people were saying that my mic has been coming in a bit quiet lately... maybe that was a sign of it dying

#

Β―_(ツ)_/Β―

#

Yeah. you would

#

He could solder it back together

#

He is really handy

#

Yeah, I'm not that great at electrical engineering

#

Yeah, same... I just haven't really soldered anything before

#

Hey @robust oasis πŸ‘‹

robust oasis
#

hello

wind raptor
#

These headphones aren't that expensive, but they also aren't that cheap either

#

Arctis 3 I think

#

I do...

#

I guess we could do that

#

It's a $20 webcam though bahaha

robust oasis
#

it would make voice chat more voicy

wind raptor
#

true

#

ok, one sec

#

lol

robust oasis
#

Sounds bad, but we hear you.

#

lol

somber heath
#

@neat radish πŸ‘‹

neat radish
#

hi

robust oasis
fierce stratus
neat radish
#

nonono

#

sorry

somber heath
fierce stratus
#
def test_sign_up():
    username = generate_random_string()
    password = generate_random_string()
    global test_tmp_user_id
    print(username, 'sdfasdfasdfasdfsdfas')
    response = client.post(
        "/users/",
        json={"username": username, "password": password}
    )
    assert response.status_code == 200
    assert response.json() == {
        "username": username,
        "disabled": False,
        "full_name": None,
        "id": response.json().get("id"),
        "tasks": []
    }
    test_tmp_user_id = response.json().get("id")```
old heart
#

hio

#

don't have my mic plugged in, making some music atm

#

how are you all

#

doing ok

#

does anyone have advice for a network admin use cases for python automatic scripts which may be suitable alternatives for things you'd normally do in ps

somber heath
#

Whoever was speaking, I didn't hear you very well.

fierce stratus
#

πŸ™‚

#

@wind raptor , do you know any good source for sample pytests?
I am writing tests, I feel like I am covering only basic part of code, so I thought if I have sample of other tests, I could use them.

urban summit
#
with open(file_path, "w") as csv: 
    csv.write("Product Name,Price\n") 
 
    soup = BeautifulSoup(response.text, "html.parser") 
    allproducts = soup.find_all('div', class_='w-pie--product-tile__content') 
    for product in allproducts: 
        name = product.find('h2', class_='w-cms--font-body__sans-bold') 
        if name is None or name.text.strip() == '': 
            name = product.find('span', class_='w-cms--font-disclaimer', attrs={'data-testid': 'product-tile-brand'})
        
        price = product.find('span', class_='text-left bds--heading-5') 
        if price is None: 
            price = product.find('div', class_='bds--heading-5 mr-1 inline px-1 !text-base') 
 
        # Check if name and price were found 
        if name is None or price is None: 
            print("Failed to find product name or price. Skipping...") 
            continue 
 

#
        # Process price text
        price_text = price.text
        if 'Β’' in price_text:
            price_text = price_text.replace('Β’', '')
            price_value = float(price_text) / 100
        elif '/lb' in price_text:
            price_text = price_text.replace('/lb', '')
            price_value = float(price_text.replace('$', '').replace(',', ''))
        else:
            price_value = float(price_text.replace('$', '').replace(',', ''))
        
        csv.write(f"{name.text.replace(',', ' ')},{price_value}\n")

upbeat bobcat
#

@somber heath He is not here. He said he will be back in few minutes.

somber heath
#

@dawn flicker πŸ‘‹

dawn flicker
#

Hey

#

I think I'm "voice suppressed"

#

Will have to post 50 some messages in the sever to have it give me access

#

I'll go text in general for a bit and then will be back

#

Wait, what's the closest thing we have to a #general here?

somber heath
#

@tough wolf πŸ‘‹

tough wolf
#

If any of you code in javascript do you think its easier to web scrape in python or javascript

dawn flicker
#

I'm a javascript engineer. I used to do scraping 4 years ago. Ended up trying it both via Js & python, no real difference really. Depends less on the language and more on what tool you're using for scraping and if it fits your needs

#

Tho, if you are more comfortable in one of these languages than the other, then just go with it. See what tools you ahve in that language for scraping see if any of them can do what you want

somber heath
#

@boreal kestrel πŸ‘‹

coarse geyser
#

@wind raptor hey ,
can you tell me which puzzle i should solve so my voice got verified ,coz the three days trial have been end , yet still can't talk

You are not currently eligible to use voice inside Python Discord for the following reasons:

You have sent less than 50 messages.
You have been active for fewer than 3 ten-minute blocks.```
#

@smoky burrow @uncut meteor @hollow cape

smoky burrow
#

The reason is in the text you posted, have you read it?

coarse geyser
somber heath
#

I will be happy to read it for you if you join right now.

coarse geyser
#

thanks hh, but should i send like 50 msgs or wat

#

okay , but am an introvert

#

50 msgs is too much guys

#

where i can find people who want to chat ? hhh

#

can you make an exception for me guys (5 msgs enough..)..
but i will see nd try maybe

peak depot
robust oasis
#

50 messages is easy.

somber heath
#

@modern ibex πŸ‘‹

modern ibex
coarse geyser
#

about what !

robust oasis
#

You're doing it now.

coarse geyser
#

yea am new to it

#

data structure, high level functions,

#

.. and a lot more

somber heath
#

@sharp lotus πŸ‘‹

coarse geyser
#

my goal from joining the server is to be better at communication at first

sharp lotus
#

hello

#

where are you from?

coarse geyser
sharp lotus
#

ohh nice

#

I am from India

coarse geyser
#

okay

upbeat bobcat
#

!paste

wise cargoBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

upbeat bobcat
#
    def center(self):
        qr = self.frameGeometry()
        cp = QtGui.QGuiApplication.primaryScreen().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

I am using this in the code I had sent to center the window of calendar, it is not working but it working for other things like I have calculator and it is working for it.

#

@vocal basin can you help me?

vocal basin
#

I can't rn (fever, not very good state for debugging)

upbeat bobcat
vocal basin
#

@prisma summit you have mic open (in case you don't know)

prisma summit
#

i know

upbeat bobcat
vocal basin
#

some conversation is coming through

prisma summit
#

anyone know node js

vocal basin
#

I use node.js somewhat regularly

prisma summit
#

i have some doubts

#

i am a begginer

#

i want to learn backend but i dont know which is best fast api or node js

#

@vocal basin

vocal basin
#

nodejs is a bit easier to use with "full-stack" frameworks like Next.js

#

that way you get a single-language single-package codebase responsible for both back-end and front-end

#

(sometimes that's simpler to work with)

#

you should decide based on back-end libraries you plan on using, imo

prisma summit
#

i am very confuse about this @vocal basin

#

because once i choose then its become my career domain

stark river
#

both are approx same.
fastapi is nice and pythonic.
nodejs allows for same lang to be used on frontend and backend.

vocal basin
prisma summit
#

why both parally?

upbeat bobcat
vocal basin
stark river
prisma summit
#

i am a frontend

vocal basin
#

for front-end, there's mostly only JavaScript

#

and whatever builds on top of it

prisma summit
#

no i mean

#

i am a front end developer

vocal basin
#

if you use React for front-end, then one of the easiest ways is to go with Next.js/Remix/whatever else

prisma summit
#

python have large libraries count

#

js dont have much

vocal basin
#

npm is huge

prisma summit
#

but i can use it for both fronent and backend

#

can i analysis data by js

#

python have panda

vocal basin
#

if you need pandas, then FastAPI

prisma summit
#

i can do website scraping by python for testing

vocal basin
#

you can also just use both FastAPI and Node.js

#

Node.js for stuff closer to front-end

#

and FastAPI for whatever microservice that requires Python libraries

prisma summit
#

not panda data analysis library

#

so you suggest mostly use node but use fastapi for specific python function

#

if i go deep in domain can i parally learn both

prisma summit
#

because i am already a front end developer

vocal basin
#

wait I forgot

#

I didn't mean gRPC

prisma summit
#

i am afraid of learning load

vocal basin
prisma summit
#

you think one can master 3 different parts front end backend node and python

stark river
#

use web assembly and directly call binaries in js

vocal basin
#

^ also a possibility if you want to shove all the data and compute to users

#

(at times, a suboptimal idea)

stark river
#

can binaries be called in nodejs on server side?

vocal basin
#

you can do C bindings

#

I think

prisma summit
#

python can do node js all work but node cant do python all work?

vocal basin
prisma summit
#

insteed i learn fast api

#

so no need of node js

#

node js dont have any benift than python

vocal basin
vocal basin
prisma summit
#

react

vocal basin
#

create-react-app or some framework on top of React?

prisma summit
#

create-react-app

#

not much

#

nothing else

vocal basin
willow gate
prisma summit
#

yes

willow gate
prisma summit
#

2nd

#

next js and remix are latest version of react

#

i mean extra library

vocal basin
#

even if you use FastAPI for the back-end, you can still use Next.js to get the data between FastAPI and front-end in a simpler way (via server components and actions)

prisma summit
#

whats your domain @vocal basin

vocal basin
#

Rust/Python/JS as main languages

prisma summit
#

you taste everything

vocal basin
prisma summit
#

but if you learn everything you cant remember and go deep in to it

vocal basin
#

nature of programming often requires deep knowledge in many areas at the same time

vocal basin
prisma summit
#

like?

vocal basin
#

mostly related to asynchronous IO using primitives that Linux provides

#

epoll, eventfd

#

also looking into TIPC

#

("alternative" to TCP and UDP)

prisma summit
#

i dont know that much

#

but i know you very passionate

vocal basin
prisma summit
#

@willow gate your domain?

#

you learn something in very bottom

vocal basin
prisma summit
#

like kernal in os

vocal basin
#

via

#

!d asyncio.loop.add_reader

wise cargoBOT
#

loop.add_reader(fd, callback, *args)```
Start monitoring the *fd* file descriptor for read availability and invoke *callback* with the specified arguments once *fd* is available for reading.
vocal basin
#

that thing

prisma summit
#

i learn node and fastapi but which is first ?

willow gate
prisma summit
#

nice\

vocal basin
prisma summit
#

yes i am in hackthon

#

its about clinic management automation project

vocal basin
#

imo best way is to gradually implement parts of the project alternating between learning different technologies

prisma summit
#

many clinic

willow gate
prisma summit
#

tamil nadu

willow gate
prisma summit
#

@willow gate are you in job?

vocal basin
#

both of these orders are wrong (and often impossible):
learn FastAPI, implement FastAPI part, learn Node.js, implement Node.js part;
learn Node.js, implement Node.js part, learn FastAPI, implement FastAPI part;

willow gate
prisma summit
#

thats why i ask which is first i learn

vocal basin
#

Node.js (with Next.js), because you'll have more visual feedback

prisma summit
#

@vocal basin are you in job?

#

ok

vocal basin
prisma summit
#

nice

#

node is backend then how i get visual feedback

vocal basin
#

Next.js

#

it's both backend and frontend

#

in front-end React you can call functions from the back-end

prisma summit
#

then what is express js and next js and remix

#

i read you send docs but i cant get clearly

vocal basin
#

express.js to next.js is what starlette is to fastapi

#

underlying implementation of an HTTP server

prisma summit
#

so i learn both

vocal basin
#

from what I remember, Next.js isn't strictly tied to express.js

prisma summit
#

@vocal basin your experiance

vocal basin
#

in years?

prisma summit
#

yes

vocal basin
#

7 years of Python/C#

#

4 years of JavaScript/TypeScript

#

2 years of Rust (which I know better than everything else)