Discuss Scratch

proprogrammer44
Scratcher
59 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchcatandGobo wrote:

Traceback (most recent call last):
File “CUsers/censord/OneDrive/Desktop/Griffpatch.py”, line 6, in <module>
conn.set_var(“Followers”, 1)
File “C:\Users\lcensord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\scratchattach\_cloud.py”, line 50, in set_var
if len(value) > 256:
TypeError: object of type ‘int’ has no len()
cast it to a string
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchcatandGobo wrote:

How are you even supposed to set a cloud variable to a python variable? This is really bugging me…
conn = session.connect_cloud(project_id=“688967859”)
user = session.connect_user(“griffpatch”)
session.get_linked_user()
variable = user.follower_count()
conn.set_var(“Username”, variable)

To fix the problem, replace
 conn.set_var("Username", variable) 
with
 conn.set_var("Username", str(variable)) 

Or update to the latest scratchattach version using
 pip install scratchattach --upgrade

My profile / Mein Profil: @TimMcCool
ScratchTheCoder12345
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

What caused you to rename it? Just curious.

Hello, I'm Brandon a Python developer who loves math and coding.
Feel free to message me with any questions
coolcoder1213
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchTheCoder12345 wrote:

What caused you to rename it? Just curious.


Yeah?

So, this is just a signature.

Scratchleton - Hamilton Mod

Cloud Stats Projects

My Profile:
coolcoder1213

I am great at cloud variables and Python.
BLUE_2030
Scratcher
3 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Traceback (most recent call last):
File “C:\Users\X240\PycharmProjects\pythonProject6\scratch3.py\test.py”, line 1, in <module>
import scratch3
File “C:\Users\X240\PycharmProjects\pythonProject6\venv\scratch3.py”, line 3, in <module>
session = scratch3.login(“username”, “passwordo”) #replace with your data
AttributeError: partially initialized module ‘scratch3’ has no attribute ‘login’ (most likely due to a circular import)

Last edited by BLUE_2030 (May 11, 2022 23:42:51)

ScratchcatandGobo
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

BLUE_2030 wrote:

Traceback (most recent call last):
File “C:\Users\X240\PycharmProjects\pythonProject6\scratch3.py\test.py”, line 1, in <module>
import scratch3
File “C:\Users\X240\PycharmProjects\pythonProject6\venv\scratch3.py”, line 3, in <module>
session = scratch3.login(“username”, “passwordo”) #replace with your data
AttributeError: partially initialized module ‘scratch3’ has no attribute ‘login’ (most likely due to a circular import)
add ()

ScratchcatandGobo Scratching since 2019
i am currently learning lua (roblox), C sharp, and python. I also work on Orange OS linux, basicly normal Orange, but made with linux, and better.
Orange os Linux edition

▲ Click the banner to learn more ▲

50th post
/url 100th post
Redirect to project ID block
Here is my status (via aviate) here
kccuber
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchTheCoder12345 wrote:

What caused you to rename it? Just curious.
It sounded like it was the name of a python file before

BLUE_2030 wrote:

Traceback (most recent call last):
File “C:\Users\X240\PycharmProjects\pythonProject6\scratch3.py\test.py”, line 1, in <module>
import scratch3
File “C:\Users\X240\PycharmProjects\pythonProject6\venv\scratch3.py”, line 3, in <module>
session = scratch3.login(“username”, “passwordo”) #replace with your data
AttributeError: partially initialized module ‘scratch3’ has no attribute ‘login’ (most likely due to a circular import)
update the module, it's called scratchattach now and shouldn't be causing circular import error because it's not named scratch3.py anymore
pip install scratchattach --upgrade

Last edited by kccuber (May 12, 2022 01:26:39)



Made using Nord Theme & Inkscape
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchcatandGobo wrote:

How are you even supposed to set a cloud variable to a python variable? This is really bugging me…
conn = session.connect_cloud(project_id=“688967859”)
user = session.connect_user(“griffpatch”)
session.get_linked_user()
variable = user.follower_count()
conn.set_var(“Username”, variable)

scratchAttach.get_var(“project_id”, “variable”)
(thats whati get from the github docs, you should read it)
this function returns the value of the variable, so you can kind catch it with
variableOfYourChoice = scratch3.get_var(“project_id”, “variable”)
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchcatandGobo wrote:

How are you even supposed to set a cloud variable to a python variable? This is really bugging me…
conn = session.connect_cloud(project_id=“688967859”)
user = session.connect_user(“griffpatch”)
session.get_linked_user()
variable = user.follower_count()
conn.set_var(“Username”, variable)

oh im stupid, cloud variable to python variable..
so the first thing you wanna do is create an VALID session, which you do by doing
session = scratchattach.login(“username”, “password”)
not that the password must be correct.
connection = session.connect_cloud(project_id=“project_id”)
this sends a handshake to the scratch servers to know you want to connect to the cloud
connection.set_var(“variable”, “value”)
this now sets the variable on the project you specified when connecting to the project with session.connect_cloud(project_id=“yourprojectid”)
so thats it. just replace everything that is in “” with the values you have
_Paxw_
Scratcher
1 post

scratchattach - A Scratch API wrapper | v1.0 released (Python)

how are you
ScratchTheCoder12345
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

kccuber wrote:

ScratchTheCoder12345 wrote:

What caused you to rename it? Just curious.
It sounded like it was the name of a python file before

BLUE_2030 wrote:

Traceback (most recent call last):
File “C:\Users\X240\PycharmProjects\pythonProject6\scratch3.py\test.py”, line 1, in <module>
import scratch3
File “C:\Users\X240\PycharmProjects\pythonProject6\venv\scratch3.py”, line 3, in <module>
session = scratch3.login(“username”, “passwordo”) #replace with your data
AttributeError: partially initialized module ‘scratch3’ has no attribute ‘login’ (most likely due to a circular import)
update the module, it's called scratchattach now and shouldn't be causing circular import error because it's not named scratch3.py anymore
pip install scratchattach --upgrade
ohhhh, I'm so stupid lol

Hello, I'm Brandon a Python developer who loves math and coding.
Feel free to message me with any questions
PoIygon
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchTheCoder12345 wrote:

What caused you to rename it? Just curious.
Why would a person name it “scratch3” or something like that when it can only do cloud stuff? He changed it because it can only do cloud stuff and “scratch3” implies that it can do everything in the scratch website



UxuginAI
Scratcher
4 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

scratchfan321 wrote:

Danger comes from myself + terminal
More danger comes from You + Terminal + Sudo
ScratchcatandGobo
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

project.set_title(“This project has ”project.views“ Views and ”project.loves“ Loves”)
Syntax error

ScratchcatandGobo Scratching since 2019
i am currently learning lua (roblox), C sharp, and python. I also work on Orange OS linux, basicly normal Orange, but made with linux, and better.
Orange os Linux edition

▲ Click the banner to learn more ▲

50th post
/url 100th post
Redirect to project ID block
Here is my status (via aviate) here
coolcoder1213
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchTheCoder12345 wrote:

kccuber wrote:

ScratchTheCoder12345 wrote:

What caused you to rename it? Just curious.
It sounded like it was the name of a python file before

BLUE_2030 wrote:

Traceback (most recent call last):
File “C:\Users\X240\PycharmProjects\pythonProject6\scratch3.py\test.py”, line 1, in <module>
import scratch3
File “C:\Users\X240\PycharmProjects\pythonProject6\venv\scratch3.py”, line 3, in <module>
session = scratch3.login(“username”, “passwordo”) #replace with your data
AttributeError: partially initialized module ‘scratch3’ has no attribute ‘login’ (most likely due to a circular import)
update the module, it's called scratchattach now and shouldn't be causing circular import error because it's not named scratch3.py anymore
pip install scratchattach --upgrade
ohhhh, I'm so stupid lol


Yeah. I asked the same question.

So, this is just a signature.

Scratchleton - Hamilton Mod

Cloud Stats Projects

My Profile:
coolcoder1213

I am great at cloud variables and Python.
SansStudios
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

ScratchcatandGobo wrote:

project.set_title(“This project has ”project.views“ Views and ”project.loves“ Loves”)
Syntax error

That isn't how you combine strings in python.

You can use an addition operator:

text = "This project has " + str(project.views) + " Views and " + str(project.loves) + " Loves"

Or a f-string:

text = f"This project has {project.views} Views and {project.loves} Loves"

Or others like `str.format`

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
Wolf_Hunter77
Scratcher
11 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Sounds hard but good. I hope to see more projects using it in the future.

Hello Everyone who is reading this! Check out my game Spider Scratch where you play as the scratch universe's Spider Man as you fight villains and try to escape Oscorp! Click here to Play!
scratchyjimjam
Scratcher
79 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

this is really good! I'm using it on one of my projects right now!

when green flag clicked
say [This is scratchyjimjam's signature] for (2) secs


-SCRATCHYJIMJAM-
729593Patrek
Scratcher
12 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

What server do you recommend? Replit shuts down all the time for me? I have to keep it free though…
CST1229
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

729593Patrek wrote:

(#60)
What server do you recommend? Replit shuts down all the time for me? I have to keep it free though…
Personally I'd use Replit + some library to have the server serve a HTTP page somewhere + some pinger that pings said page (uptimerobot or verixion's pinger also on replit)

This is a signature. It's text that appears below each post I write. Click here to learn more. And use Shift+Down to see more if you're on Chrome.
my favorite coding website in which sharing code, extensions or websites written with code isn't allowed (credit to jeffalo and chiroyce)

thugatwoary's signature wrote:

can we not just spam “use contact us” all over questions about scratch? thats not helpful

Powered by DjangoBB

Standard | Mobile