Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » [fixed] help with repl.it
- catkitty12021
- Scratcher
9 posts
[fixed] help with repl.it
I'm kind of new with repl.it, and this is the first time I've made a topic. Honestly I'm inexperienced with everything except Scratch.
I got some python code here, and in theory, it is supposed to serve as a database for my project.But when I run this in repl.it, it returns this error:
I don't know what happened…
I got some python code here, and in theory, it is supposed to serve as a database for my project.
import scratchapi
scratch = scratchapi.ScratchUserSession('<username hidden>', '<password hidden>', remember_password=True)
while True:
a = ScratchUserSession.cloud.get_var('☁ mode', 543069795)
b = ScratchUserSession.cloud.get_var('☁ var', 543069795)
c = ScratchUserSession.cloud.get_var('☁ var2', 543069795)
if a == 1:
Users.append(b)
RealUsers.append(b)
Pass.append(c)
if a == 2:
b = ScratchUserSession.cloud.get_var('☁ var', 543069795)
d = RealUsers.index(b)
ScratchUserSession.cloud.set_var('☁ mode', 4, 543069795)
while True:
c = ScratchUserSession.cloud.get_var('☁ mode', 543069795)
if (c == 5):
break
c = ScratchUserSession.cloud.get_var('☁ var', 543069795)
Users[d] = c
if a == 3:
b = ScratchUserSession.cloud.get_var('☁ var', 543069795)
d = RealUsers.index(b)
ScratchUserSession.cloud.set_var('☁ mode', 4, 543069795)
while True:
c = ScratchUserSession.cloud.get_var('☁ mode', 543069795)
if (c == 5):
break
c = ScratchUserSession.cloud.get_var('☁ var', 543069795)
Pass[d] = c
if a == 10:
c = ScratchUserSession.cloud.get_var('☁ var', 543069795)
if c in list:
d = RealUsers.index(c)
c = Users[d]
b = Pass[d]
ScratchUserSession.cloud.set_var('☁ var', c, 543069795)
ScratchUserSession.cloud.set_var('☁ var2', b, 543069795)
else:
ScratchUserSession.cloud.set_var('☁ mode', 100, 543069795)
ScratchUserSession.cloud.set_var('☁ mode', 0, 543069795)
Traceback (most recent call last):
File "main.py", line 2, in <module>
scratch = scratchapi.ScratchUserSession('<username hidden>', '<password hidden>', remember_password=True)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/scratchapi.py", line 99, in __init__
self.tools.update()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/scratchapi.py", line 192, in _tools_update
self.HEADERS['Cookie'] = 'scratchcsrftoken=' + self.lib.utils.session.cookies.get_dict()['scratchcsrftoken'] + '; scratchsessionsid=' + self.lib.utils.session.cookies.get('scratchsessionsid') + '; scratchlanguage=en'
TypeError: can only concatenate str (not "NoneType") to str
I don't know what happened…
Last edited by catkitty12021 (June 21, 2021 17:35:22)
- Raihan142857
- Scratcher
1000+ posts
[fixed] help with repl.it
the scratchapi module does not work anymore
I use scratch.
GF: I'll dump you. BF: hex dump or binary dump?
- catkitty12021
- Scratcher
9 posts
[fixed] help with repl.it
.-.
time to rewrite the whole thing from scratch in node
… I know nothing of node
time to rewrite the whole thing from scratch in node
… I know nothing of node
Last edited by catkitty12021 (June 18, 2021 03:28:17)
- Chiroyce
- Scratcher
1000+ posts
[fixed] help with repl.it
Try using scratchclient as scratchapi is broken.
April Fools' topics:
— New Buildings in Scratch's headquarters
— Give every Scratcher an M1 MacBook Air
— Scratch should let users edit other Scratchers' projects
— Make a statue for Jeffalo
— Scratch Tech Tips™
— Make a Chiroyce statue emoji
<img src=“x” onerror=“alert('XSS vulnerability discovered')”>
this is a test sentence
- gdpr5b78aa4361827f5c2a08d700
- Scratcher
1000+ posts
[fixed] help with repl.it
scratchclient as scratchapi is broken.its also made by this guy. Try using
the scratchapi module does not work anymore
- catkitty12021
- Scratcher
9 posts
[fixed] help with repl.it
ok I'm so excited
it actually works
it actually works
Last edited by catkitty12021 (June 18, 2021 18:04:59)
- catkitty12021
- Scratcher
9 posts
[fixed] help with repl.it
now it isn't working
it doesn't give me any errors, but the “get account info” custom block keeps running
it seems like repl.it doesn't change the “mode” cloud variable
Python:
Scratch:
did I do anything wrong?
it doesn't give me any errors, but the “get account info” custom block keeps running
it seems like repl.it doesn't change the “mode” cloud variable
Python:
from scratchclient import ScratchSession
session = ScratchSession("<removed>", "<removed>")
connection = session.create_cloud_connection(543069795)
RealUsers = []
Users = []
Pass = []
while True:
a = connection.get_cloud_variable("mode")
b = connection.get_cloud_variable("var")
c = connection.get_cloud_variable("var2")
if a == 6:
c = connection.get_cloud_variable("var")
if c in RealUsers:
d = RealUsers.index(c)
c = Users[d]
b = Pass[d]
connection.set_cloud_variable("var", c)
connection.set_cloud_variable("var2", b)
connection.set_cloud_variable("mode", 8)
else:
connection.set_cloud_variable("mode", 7)
while c != 9:
c = connection.get_cloud_variable("mode")
connection.set_cloud_variable("mode", 0)
Scratch:
did I do anything wrong?
- catkitty12021
- Scratcher
9 posts
[fixed] help with repl.it
So, I did some testing with this code:
Note: “e” is a variable that recieves the value for “req”
When I set the cloud variable “req” to 2, “mode” gets 2 assigned to it. But when I set “req” to 1, “mode” still becomes 2. What happened?
Edit: Now I did some more testing, and the results confuse me.
The code does the same thing, except that it sets a cloud variable “var” to e. I saw that “var” was equal to 1, but “mode” was equal to 2. I don't understand.
Edit 2: Ahh… I see. “e” was counted as a string. That explains everything.
from scratchclient import ScratchSession
session = ScratchSession("<removed>", "<removed>")
connection = session.create_cloud_connection(543069795)
while True:
e = connection.get_cloud_variable("req")
if e == 1:
connection.set_cloud_variable("mode", 1)
else:
connection.set_cloud_variable("mode", 2)
Note: “e” is a variable that recieves the value for “req”
When I set the cloud variable “req” to 2, “mode” gets 2 assigned to it. But when I set “req” to 1, “mode” still becomes 2. What happened?
Edit: Now I did some more testing, and the results confuse me.
from scratchclient import ScratchSession
session = ScratchSession("StickRed_Test", "AlanBecker")
connection = session.create_cloud_connection(543069795)
while True:
e = connection.get_cloud_variable("req")
connection.set_cloud_variable("var", e)
if e == 1:
connection.set_cloud_variable("mode", 1)
else:
connection.set_cloud_variable("mode", 2)
The code does the same thing, except that it sets a cloud variable “var” to e. I saw that “var” was equal to 1, but “mode” was equal to 2. I don't understand.
Edit 2: Ahh… I see. “e” was counted as a string. That explains everything.
Last edited by catkitty12021 (June 20, 2021 01:34:27)
- minniesworld
- Scratcher
100+ posts
[fixed] help with repl.it
I'm having a similar problem.
The Python code I'm using is:
import scratchapi
scratch = scratchapi.ScratchUserSession('—', ‘—’, remember_password=True)
scratch.tools.verify_session()
After “scratch = scratchapi.ScratchUserSession('—', ‘—’, remember_password=True)”, it prompts:
Traceback (most recent call last):
File “C:\Users\—\OneDrive\Desktop\scratch test.py”, line 2, in <module>
scratch = scratchapi.ScratchUserSession('—', ‘—’, remember_password=True)
File “C:\Users\—\AppData\Local\Programs\Python\Python39\lib\site-packages\scratchapi.py”, line 99, in __init__
self.tools.update()
File “C:\Users\—\AppData\Local\Programs\Python\Python39\lib\site-packages\scratchapi.py”, line 192, in _tools_update
self.HEADERS = ‘scratchcsrftoken=’ + self.lib.utils.session.cookies.get_dict() + ‘; scratchsessionsid=’ + self.lib.utils.session.cookies.get('scratchsessionsid') + ‘; scratchlanguage=en’
TypeError: can only concatenate str (not “NoneType”) to str
I was following a guide on Github
The Python code I'm using is:
import scratchapi
scratch = scratchapi.ScratchUserSession('—', ‘—’, remember_password=True)
scratch.tools.verify_session()
After “scratch = scratchapi.ScratchUserSession('—', ‘—’, remember_password=True)”, it prompts:
Traceback (most recent call last):
File “C:\Users\—\OneDrive\Desktop\scratch test.py”, line 2, in <module>
scratch = scratchapi.ScratchUserSession('—', ‘—’, remember_password=True)
File “C:\Users\—\AppData\Local\Programs\Python\Python39\lib\site-packages\scratchapi.py”, line 99, in __init__
self.tools.update()
File “C:\Users\—\AppData\Local\Programs\Python\Python39\lib\site-packages\scratchapi.py”, line 192, in _tools_update
self.HEADERS = ‘scratchcsrftoken=’ + self.lib.utils.session.cookies.get_dict() + ‘; scratchsessionsid=’ + self.lib.utils.session.cookies.get('scratchsessionsid') + ‘; scratchlanguage=en’
TypeError: can only concatenate str (not “NoneType”) to str
I was following a guide on Github
Baa
- ScolderCreations
- Scratcher
1000+ posts
[fixed] help with repl.it
scratchapi does not work anymore, you'll have to use scratchclient.
- Discussion Forums
- » Advanced Topics
- » [fixed] help with repl.it