Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchclient - A scratch API wrapper for python
- Chiroyce
-
Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
can anyone tell me the thing that is wrong here?
what error do you get?
- nikoniko0826
-
Scratcher
16 posts
scratchclient - A scratch API wrapper for python
Should I enter this code into Python?Please tell me the code to attach stars and hearts to Project.this is technically not allowed, but I'm guessing you're interested for educational purposesfrom scratchclient import ScratchSession session = ScratchSession("username", "password") project = session.get_project(<put your project ID here>) project.love() project.favorite()
- nikoniko0826
-
Scratcher
16 posts
scratchclient - A scratch API wrapper for python
(#626)Should I enter this code into Python?Please tell me the code to attach stars and hearts to Project.this is technically not allowed, but I'm guessing you're interested for educational purposesfrom scratchclient import ScratchSession session = ScratchSession("username", "password") project = session.get_project(<put your project ID here>) project.love() project.favorite()
- mrcoat
-
Scratcher
100+ posts
scratchclient - A scratch API wrapper for python
Yes(#626)Should I enter this code into Python?Please tell me the code to attach stars and hearts to Project.this is technically not allowed, but I'm guessing you're interested for educational purposesfrom scratchclient import ScratchSession session = ScratchSession("username", "password") project = session.get_project(<put your project ID here>) project.love() project.favorite()
- myscript423
-
Scratcher
37 posts
scratchclient - A scratch API wrapper for python
ATTENTION ALL PYTHON 3 USERS HOPING TO GET THIS:
use:instead of: ~small difference, yet only works this way~
use:
pip3 install scratchclient
pip install scratchclient
- ninjaMAR
-
Scratcher
1000+ posts
scratchclient - A scratch API wrapper for python
(#629)This is incorrect. pip and pip3 could correspond to different versions of python. My system used to have multiple versions of python (until I cleaned it up), each with it's own version of pip. “python” referenced python2.7, “python3.9” referenced python3.9, and “python3” referenced python3.11. Pip was a mess. “pip3” pointed to python3.9, and “pip” pointed to python3.11. Pip and pip3 aren't always interchangeable. The best way to verify you have the correct installation is to run.
ATTENTION ALL PYTHON 3 USERS HOPING TO GET THIS:
use:instead of:pip3 install scratchclient~small difference, yet only works this way~pip install scratchclient
python3 -m pip --version
pip --version
- mega_micro_2
-
New Scratcher
1 post
scratchclient - A scratch API wrapper for python
I get this error when trying to delete a comment (or reply to a comment, but this is the case where I try to delete one):
Traceback (most recent call last):The code:
File “<stdin>”, line 1, in <module>
File "C:\Users\XXXXX\AppData\Roaming\Python\Python312\site-packages\scratchclient\Comment.py“, line 155, in delete
self._comment_action(”del“, self.id, self.user, self._client)
File ”C:\Users\XXXXX\AppData\Roaming\Python\Python312\site-packages\scratchclient\Comment.py", line 139, in _comment_action
client._ensure_logged_in()
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘str’ object has no attribute ‘_ensure_logged_in’
comment = session.scraping.get_profile_comments(“mega_micro_2”)[0 # I didn't close the square bracket because forum formatting didn't like that
comment.delete()
- AdamKRPS425
-
Scratcher
44 posts
scratchclient - A scratch API wrapper for python
Does this happen to anyone else? I haven't retried in a while but I don't know if this still is an issueI noticed that with some scratch projects, attempting to establish a cloud connection yields an infinite waiting cycle. Any idea why this may be?This happens to me - EVERY TIME its very annoying, someone please help with this
- nikoniko0826
-
Scratcher
16 posts
scratchclient - A scratch API wrapper for python
I typed the code 「
import scratchconnect
import datetime
user = scratchconnect.ScratchConnect(“nikoniko0826”, “########”)
project = user.connect_project(project_id=##########)
variables = project.connect_cloud_variables()
date=datetime.datetime.now()
this=datetime.date.today()
print(this)
set= variables.set_cloud_variable(variable_name=“present”, value=this)
」, but I cannot change the cloud variable.
import scratchconnect
import datetime
user = scratchconnect.ScratchConnect(“nikoniko0826”, “########”)
project = user.connect_project(project_id=##########)
variables = project.connect_cloud_variables()
date=datetime.datetime.now()
this=datetime.date.today()
print(this)
set= variables.set_cloud_variable(variable_name=“present”, value=this)
」, but I cannot change the cloud variable.
- leog20162
-
Scratcher
100+ posts
scratchclient - A scratch API wrapper for python
nikoniko0826
Last edited by leog20162 (Aug. 3, 2024 05:46:41)
- leog20162
-
Scratcher
100+ posts
scratchclient - A scratch API wrapper for python
I typed the code 「bru, you can't set a variable to a text!!!!!!!!!!!!」, but I cannot change the cloud variable.import scratchconnect import datetime user = scratchconnect.ScratchConnect("nikoniko0826", "########") project = user.connect_project(project_id=##########) variables = project.connect_cloud_variables() date=datetime.datetime.now() this=datetime.date.today() print(this) set= variables.set_cloud_variable(variable_name="present", value=this)
Last edited by leog20162 (Aug. 3, 2024 05:47:48)
- Walle2011
-
Scratcher
18 posts
scratchclient - A scratch API wrapper for python
Sometimes I get this error, I've done a bit of research but I can't seem to find what causes it, nor how to fix it, could someone explain to me who to fix it?
Exception in thread Thread-1 (_cloud_var_loop):
Traceback (most recent call last):
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\threading.py”, line 1041, in _bootstrap_inner
self.run()
~~~~~~~~^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\threading.py”, line 992, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\CloudConnection.py”, line 221, in _cloud_var_loop
response = self._ws.recv()
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\Websocket.py”, line 236, in recv
data, opcode = self.recv_data()
~~~~~~~~~~~~~~^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\Websocket.py”, line 211, in recv_data
frame, err = Frame.decode_beginning(beginning_data)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\Websocket.py”, line 103, in decode_beginning
header = response
~~~~~~~~^^^
IndexError: index out of range
Exception in thread Thread-1 (_cloud_var_loop):
Traceback (most recent call last):
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\threading.py”, line 1041, in _bootstrap_inner
self.run()
~~~~~~~~^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\threading.py”, line 992, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\CloudConnection.py”, line 221, in _cloud_var_loop
response = self._ws.recv()
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\Websocket.py”, line 236, in recv
data, opcode = self.recv_data()
~~~~~~~~~~~~~~^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\Websocket.py”, line 211, in recv_data
frame, err = Frame.decode_beginning(beginning_data)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File “C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\site-packages\scratchclient\Websocket.py”, line 103, in decode_beginning
header = response
~~~~~~~~^^^
IndexError: index out of range
- Discussion Forums
- » Advanced Topics
-
» scratchclient - A scratch API wrapper for python









