Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchattach - A Scratch API wrapper (Python)
- Mast_Scratch
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
i am writing this code into the python thingimport osi get this error
os.system(“pip install -U scratchattach”)
1
import scratchattach as scratch3Traceback (most recent call last):i have no idea why this script is not working i got no error when i download it so why wont this work
File “<pyshell#9>”, line 1, in <module>
import scratchattach
ModuleNotFoundError: No module named ‘scratchattach’
why is there 1, in the code?
- wvzack
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
idki am writing this code into the python thingimport osi get this error
os.system(“pip install -U scratchattach”)
1
import scratchattach as scratch3Traceback (most recent call last):i have no idea why this script is not working i got no error when i download it so why wont this work
File “<pyshell#9>”, line 1, in <module>
import scratchattach
ModuleNotFoundError: No module named ‘scratchattach’
why is there 1, in the code?
- wvzack
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
oh know i understandimport os = line 1? Line one is import os…
os.system(“pip install -U scratchattach”) = line 2
1 = line 3
import scratchattach as scratch3 = line 4
- KROKOBIL
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Use:Scratch has blocked replit from accessing scratch, with the exception of clouddata.scratch.mit.edukk
~~~
Error? Here's the code:Then, it gives me:import os import scratchattach as scratch3 from replit import db Session = os.environ["sessionID"] session = scratch3.Session(Session, username="Knightbot63") conn = scratch3.TwCloudConnection("790734555") client = scratch3.TwCloudRequests(conn) ...Code... @client.event def on_request(request): print("Received request", request.name, request.requester, request.arguments, request.timestamp, request.id) @client.event def on_unknown_request(request): print("Received unknown request", request.name, request.requester, request.arguments, request.timestamp, request.id) @client.event def on_error(request, e): print("Request: ", request.name, request.requester, request.arguments, request.timestamp, request.id) print("Error that occured: ", e) def start(): client.run()Traceback (most recent call last): File "main.py", line 1, in <module> from attach import start File "/home/runner/CatBits-Server/attach.py", line 8, in <module> conn = scratch3.TwCloudConnection("790734555") TypeError: __init__() takes 1 positional argument but 2 were given
conn = scratch3.TwCloudConnection(project_id = "790734555")
- Knightbot63
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
Huh, now it worked. Thanks! Use:conn = scratch3.TwCloudConnection(project_id = "790734555")
Working on an RPG. Consistently losing followers because of inactivity.
I head to forums time-to-time. Not as much as I used to.
- grandpasp
- Scratcher
36 posts
scratchattach - A Scratch API wrapper (Python)
I have some scratchattach code that runs OK from my computer eg:
cloud_var_dict = scratch3.get_cloud( <a valid project id> ) #returns a dictionary
Then I decided to test it on the python hosting site: “PythonAnywhere”.
When I run it from there, some code runs OK (I can pull in User and general Project data, but when I run the above line, I get a warning “…_cloud.py…The Numpy module was reloaded…discouraged…” etc. (I omitted some words) and it returns an empty list.
Does anyone have any experience with PythonAnywhere or have any idea what may be going wrong? Thanks in advance.
cloud_var_dict = scratch3.get_cloud( <a valid project id> ) #returns a dictionary
Then I decided to test it on the python hosting site: “PythonAnywhere”.
When I run it from there, some code runs OK (I can pull in User and general Project data, but when I run the above line, I get a warning “…_cloud.py…The Numpy module was reloaded…discouraged…” etc. (I omitted some words) and it returns an empty list.
Does anyone have any experience with PythonAnywhere or have any idea what may be going wrong? Thanks in advance.
- -FreeEngines-
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
defenetly a pythonanywhere issue I have some scratchattach code that runs OK from my computer eg:
cloud_var_dict = scratch3.get_cloud( <a valid project id> ) #returns a dictionary
Then I decided to test it on the python hosting site: “PythonAnywhere”.
When I run it from there, some code runs OK (I can pull in User and general Project data, but when I run the above line, I get a warning “…_cloud.py…The Numpy module was reloaded…discouraged…” etc. (I omitted some words) and it returns an empty list.
Does anyone have any experience with PythonAnywhere or have any idea what may be going wrong? Thanks in advance.
- grandpasp
- Scratcher
36 posts
scratchattach - A Scratch API wrapper (Python)
Thanks. I'll message them directly. I'm guessing that they are pre-loading NumPy as part of their python interperator environment and then Tim loads it again in _Cloud.py. Since I am in over my head here, I was hoping someone had seen something like this before so that I could explain it better. Thanks again.defenetly a pythonanywhere issue I have some scratchattach code that runs OK from my computer eg:
cloud_var_dict = scratch3.get_cloud( <a valid project id> ) #returns a dictionary
Then I decided to test it on the python hosting site: “PythonAnywhere”.
When I run it from there, some code runs OK (I can pull in User and general Project data, but when I run the above line, I get a warning “…_cloud.py…The Numpy module was reloaded…discouraged…” etc. (I omitted some words) and it returns an empty list.
Does anyone have any experience with PythonAnywhere or have any idea what may be going wrong? Thanks in advance.
- RichieRules
- Scratcher
18 posts
scratchattach - A Scratch API wrapper (Python)
Is there a tutorial on how to set it up? I made a Fortnite game and I want to be able to send people Vbucks (R-Bucks)
I already have python downloaded.
I already have python downloaded.
ENTER MY DMC
- Knightbot63
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
Setup the program? Or the code for it? Is there a tutorial on how to set it up? I made a Fortnite game and I want to be able to send people Vbucks (R-Bucks)
I already have python downloaded.
Working on an RPG. Consistently losing followers because of inactivity.
I head to forums time-to-time. Not as much as I used to.
- Crystxl-
- Scratcher
6 posts
scratchattach - A Scratch API wrapper (Python)
@wvzack
Should be:
import os
os.system(“pip install scratchattach”)
import scratchattach as scratch3
instead
Sorry, I don't have time to format this post but wishing you good luck on whatever you're trying to create
Should be:
import os
os.system(“pip install scratchattach”)
import scratchattach as scratch3
instead
Sorry, I don't have time to format this post but wishing you good luck on whatever you're trying to create
ᴄʏxʟ-
- wvzack
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
i get a syntax error @wvzack
Should be:
import os
os.system(“pip install scratchattach”)
import scratchattach as scratch3
instead
Sorry, I don't have time to format this post but wishing you good luck on whatever you're trying to create
- -FreeEngines-
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
Is there a tutorial on how to set it up? I made a Fortnite game and I want to be able to send people Vbucks (R-Bucks)
I already have python downloaded.
what is this syntax error? i would guess its something like pip is not recognized as an internal or external command. in this case you have to download pip, which is pythons package mangaer. it essentially allows you to install external “packages”, also called libaries, into python and use code they bring with them. Installing it varies on the device you are oni get a syntax error @wvzack
Should be:
import os
os.system(“pip install scratchattach”)
import scratchattach as scratch3
instead
Sorry, I don't have time to format this post but wishing you good luck on whatever you're trying to create
- Mast_Scratch
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
ummm I forgot, how do I install scratchattach on desktop? (not desktop desktop I mean the folder) it says pip isn't a command (shortened form of something big)
EDIT : I REALLY FORGOT
EDIT : I THINK I FOUND A WAY
EDIT : NOPE, The term ‘pip’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1 what should I do? (I forgot as I said before)
EDIT : I REALLY FORGOT
EDIT : I THINK I FOUND A WAY
EDIT : NOPE, The term ‘pip’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1 what should I do? (I forgot as I said before)
Last edited by Mast_Scratch (Jan. 29, 2023 09:20:39)
- Redstone1080
- Scratcher
1000+ posts
scratchattach - A Scratch API wrapper (Python)
(#1422)are you using a venv? that shouldn't happen if so..
ummm I forgot, how do I install scratchattach on desktop? (not desktop desktop I mean the folder) it says pip isn't a command (shortened form of something big)
EDIT : I REALLY FORGOT
EDIT : I THINK I FOUND A WAY
EDIT : NOPE, The term ‘pip’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1 what should I do? (I forgot as I said before)
using a venv can resolve this. for more info, read the docs.
if you're not using one, WHAT ARE YOU DOING WITH YOUR LIFE VENVS CAN SOLVE: DEPENDENCY CONFLICTS, LET YOU CHOOSE A DIFFERENT PYTHON VERSION ETC!! ok sorry for screaming but seriously, use. venvs.
const juniper = programmer && musician; // my pronouns are she/her // i am trans and bi :P // you can call me june or juni for short but i prefer juniper
juniper = programmer and musician # my pronouns are she/her # i am trans and bi :P # you can call me june or juni for short but i prefer juniper
- Erti36
- Scratcher
13 posts
scratchattach - A Scratch API wrapper (Python)
Is it possible to find out the number of your (or not your) subscribers. ??????
- MonkeyBean2
- Scratcher
100+ posts
scratchattach - A Scratch API wrapper (Python)
First of all, do not install scratchattatch every time you run the program, it is unnecessary, and wastes time.i get a syntax error @wvzack
Should be:
import os
os.system(“pip install scratchattach”)
import scratchattach as scratch3
instead
Sorry, I don't have time to format this post but wishing you good luck on whatever you're trying to create
Instead, just type
pip install scratchattach
pip3 install scratchattach
Then, copy this into your python script:
import scratchattach as scratch3
(if you don't have one yet, just make a file with the extension `.py`)
If you get any errors, please post the full error here, inside
[code][/code]
Last edited by MonkeyBean2 (Jan. 29, 2023 12:53:03)