Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- TimMcCool
-
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
- ScratchTheCoder12345
-
500+ posts
scratchattach - A Scratch API wrapper (Python)
What caused you to rename it? Just curious.
- coolcoder1213
-
100+ posts
scratchattach - A Scratch API wrapper (Python)
What caused you to rename it? Just curious.
Yeah?
- BLUE_2030
-
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
-
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)
- kccuber
-
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-
-
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-
-
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
-
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
- PoIygon
-
1000+ posts
scratchattach - A Scratch API wrapper (Python)
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 What caused you to rename it? Just curious.
- UxuginAI
-
4 posts
scratchattach - A Scratch API wrapper (Python)
More danger comes from You + Terminal + Sudo Danger comes from myself + terminal
- ScratchcatandGobo
-
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
- coolcoder1213
-
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.
- SansStudios
-
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`
- Wolf_Hunter77
-
37 posts
scratchattach - A Scratch API wrapper (Python)
Sounds hard but good. I hope to see more projects using it in the future.
- scratchyjimjam
-
90 posts
scratchattach - A Scratch API wrapper (Python)
this is really good! I'm using it on one of my projects right now!
- 729593Patrek
-
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
-
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…
- -FreeEngines-
-
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)