Discuss Scratch

Mast_Scratch
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

wvzack wrote:

i am writing this code into the python thing


import os
os.system(“pip install -U scratchattach”)
1
import scratchattach as scratch3
i get this error
Traceback (most recent call last):
File “<pyshell#9>”, line 1, in <module>
import scratchattach
ModuleNotFoundError: No module named ‘scratchattach’
i have no idea why this script is not working i got no error when i download it so why wont this work

why is there 1, in the code?


infintyrussia
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Line one is import os…


wvzack
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Mast_Scratch wrote:

wvzack wrote:

i am writing this code into the python thing


import os
os.system(“pip install -U scratchattach”)
1
import scratchattach as scratch3
i get this error
Traceback (most recent call last):
File “<pyshell#9>”, line 1, in <module>
import scratchattach
ModuleNotFoundError: No module named ‘scratchattach’
i have no idea why this script is not working i got no error when i download it so why wont this work

why is there 1, in the code?
idk

Likes: Programing (python scratch Lua c++ I am bad at c++ a) Aiviation (B787 Queen of the sky F35) Mountain Biking and Messing around with computers (not a gamer at all)
My projects I am most happy with also the few “polished games I have:
wvzack
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

infintyrussia wrote:

Line one is import os…
?

Likes: Programing (python scratch Lua c++ I am bad at c++ a) Aiviation (B787 Queen of the sky F35) Mountain Biking and Messing around with computers (not a gamer at all)
My projects I am most happy with also the few “polished games I have:
infintyrussia
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

wvzack wrote:

infintyrussia wrote:

Line one is import os…
?
import os = line 1
os.system(“pip install -U scratchattach”) = line 2
1 = line 3
import scratchattach as scratch3 = line 4


wvzack
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

infintyrussia wrote:

wvzack wrote:

infintyrussia wrote:

Line one is import os…
?
import os = line 1
os.system(“pip install -U scratchattach”) = line 2
1 = line 3
import scratchattach as scratch3 = line 4
oh know i understand

Likes: Programing (python scratch Lua c++ I am bad at c++ a) Aiviation (B787 Queen of the sky F35) Mountain Biking and Messing around with computers (not a gamer at all)
My projects I am most happy with also the few “polished games I have:
KROKOBIL
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Knightbot63 wrote:

MonkeyBean2 wrote:

Scratch has blocked replit from accessing scratch, with the exception of clouddata.scratch.mit.edu
kk
~~~
Error? Here's the code:
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()
Then, it gives me:
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
Use:
conn = scratch3.TwCloudConnection(project_id = "790734555")


Magst du in meinem Studio für deutsche Scratcher mitmachen?
Knightbot63
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

KROKOBIL wrote:

Use:
conn = scratch3.TwCloudConnection(project_id = "790734555")
Huh, now it worked. Thanks!

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.
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

grandpasp wrote:

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.
defenetly a pythonanywhere issue
grandpasp
Scratcher
36 posts

scratchattach - A Scratch API wrapper (Python)

-FreeEngines- wrote:

grandpasp wrote:

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.
defenetly a pythonanywhere issue
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.
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.

ENTER MY DMC
Knightbot63
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

RichieRules wrote:

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.
Setup the program? Or the code for it?

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

ᴄʏxʟ-
wvzack
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Crystxl- wrote:

@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
i get a syntax error

Likes: Programing (python scratch Lua c++ I am bad at c++ a) Aiviation (B787 Queen of the sky F35) Mountain Biking and Messing around with computers (not a gamer at all)
My projects I am most happy with also the few “polished games I have:
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

RichieRules wrote:

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.

wvzack wrote:

Crystxl- wrote:

@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
i get a syntax error
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 on
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)

Last edited by Mast_Scratch (Jan. 29, 2023 09:20:39)



Redstone1080
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

Mast_Scratch wrote:

(#1422)
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)
are you using a venv? that shouldn't happen if so..
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
python version:
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)

wvzack wrote:

Crystxl- wrote:

@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
i get a syntax error
First of all, do not install scratchattatch every time you run the program, it is unnecessary, and wastes time.
Instead, just type
pip install scratchattach
or
pip3 install scratchattach
In your command line/terminal (where you would type python3 to run a python program)

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]
tags.

Last edited by MonkeyBean2 (Jan. 29, 2023 12:53:03)



9NAwRfSR-%dWFS$a$g&zBMTj2?;jvS?L5%^X%qpCX|A<*paJ=lU07c)wmt$v{TxL5



scratchGui.timeTravel.year = '2020'

Powered by DjangoBB