Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- TimMcCool
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
To fix the problem, replace 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)
conn.set_var("Username", variable)
conn.set_var("Username", str(variable))
Or update to the latest scratchattach version using
pip install scratchattach --upgrade
Developer of scratchattach, the most popular Python Scratch API wrapper
- coolcoder1213
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
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 (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)
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
1000+ posts
scratchattach - A Scratch API wrapper (Python)
add () 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)
Yeah, but at least we've learned something today… that every moment of our life should be lived to the fullest because it can be very long or very short, my friend. - Gumball
I felt like I wanted to develop games on here, so I won't leave! (for now)
(last edited 2/8/24)
- kccuber
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
It sounded like it was the name of a python file before What caused you to rename it? Just curious.
update the module, it's called scratchattach now and shouldn't be causing circular import error because it's not named scratch3.py anymore 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)
pip install scratchattach --upgrade
Last edited by kccuber (May 12, 2022 01:26:39)
- -FreeEngines-
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
scratchAttach.get_var(“project_id”, “variable”) 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)
(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 (Python)
oh im stupid, cloud variable to python variable.. 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)
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
- ScratchTheCoder12345
- Scratcher
500+ posts
scratchattach - A Scratch API wrapper (Python)
ohhhh, I'm so stupid lolIt sounded like it was the name of a python file before What caused you to rename it? Just curious.update the module, it's called scratchattach now and shouldn't be causing circular import error because it's not named scratch3.py anymore 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)pip install scratchattach --upgrade
- UxuginAI
- Scratcher
4 posts
scratchattach - A Scratch API wrapper (Python)
More danger comes from You + Terminal + Sudo Danger comes from myself + terminal
- ScratchcatandGobo
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
project.set_title(“This project has ”project.views“ Views and ”project.loves“ Loves”)
Syntax error
Syntax error
Yeah, but at least we've learned something today… that every moment of our life should be lived to the fullest because it can be very long or very short, my friend. - Gumball
I felt like I wanted to develop games on here, so I won't leave! (for now)
(last edited 2/8/24)
- coolcoder1213
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
ohhhh, I'm so stupid lolIt sounded like it was the name of a python file before What caused you to rename it? Just curious.update the module, it's called scratchattach now and shouldn't be causing circular import error because it's not named scratch3.py anymore 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)pip install scratchattach --upgrade
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 (Python)
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
37 posts
scratchattach - A Scratch API wrapper (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 it to play!
.
.
- scratchyjimjam
- Scratcher
84 posts
scratchattach - A Scratch API wrapper (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 (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 (Python)
(#60)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)
What server do you recommend? Replit shuts down all the time for me? I have to keep it free though…
This is a signature. It's a piece of text that appears below every post I write. Click here to learn more, including how to make your own.
Thanks Jeffalo
RIP assets image hosting. 2013?-2023
Thanks Jeffalo
RIP assets image hosting. 2013?-2023
- -FreeEngines-
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
If replit shuts down, you're most likely using it wrongly
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)