2tables

So when I ran this code:
import os
os.system("pip install scratchattach")
it worked, but it didn't say anything.
So I ran this code:
import scratchattach as scratch3
and it popped up with an error:
Traceback (most recent call last):
File "C:\Users\directories\script.py", line 17, in <module>
import scratchattach as scratch3
ModuleNotFoundError: No module named 'scratchattach'
Is there any way to fix this?

Edit: This has been solved. In fact, I'm editing this with ScratchAttach.

BreadcatGames

2tables wrote:

Also, I tried installing PIP, and I couldn't.
Is it possible that would be the problem?
That is definitely the problem, you need pip to install scratchattach

imfh

Try opening pip with the -m option to python. For example, if you open Python with the python command, run:
python -m pip install scratchattach
If you use a different command, like py -3.10, use that instead. Hopefully it will give you useful output if it still doesn't work.

2tables

imfh wrote:

Try opening pip with the -m option to python. For example, if you open Python with the python command, run:
python -m pip install scratchattach
If you use a different command, like py -3.10, use that instead. Hopefully it will give you useful output if it still doesn't work.
This works! Thank you so much!

ajskateboarder

I have no clue why the ScratchAttach docs have this weird os.system command
Just tell people to use pip directly

2tables

ajskateboarder wrote:

I have no clue why the ScratchAttach docs have this weird os.system command
Just tell people to use pip directly
It's because you can;t run normal OS commands in Python, and have to import the os and run the command there.

ajskateboarder

2tables wrote:

It's because you can;t run normal OS commands in Python, and have to import the os and run the command there.
No I mean to open Windows PowerShell and use pip there
It's like the standard method

PPPDUD

How do you even edit posts with ScratchAttach?

2tables

PPPDUD wrote:

How do you even edit posts with ScratchAttach?
You connect to the post using the function, then edit it.
Of course, it only works if you made it.

applejuiceproduc

2tables wrote:

PPPDUD wrote:

How do you even edit posts with ScratchAttach?
You connect to the post using the function, then edit it.
Of course, it only works if you made it.
Can you show us the code though?

ScratchCatHELLO

2tables wrote:

ajskateboarder wrote:

I have no clue why the ScratchAttach docs have this weird os.system command
Just tell people to use pip directly
It's because you can;t run normal OS commands in Python, and have to import the os and run the command there.

it’s better practice (and easier in the long term) to use a terminal. you could type the command into powershell or whatever the normal shell is called on windows instead, which is what most modules ask you to do.

2tables

applejuiceproduc wrote:

2tables wrote:

PPPDUD wrote:

How do you even edit posts with ScratchAttach?
You connect to the post using the function, then edit it.
Of course, it only works if you made it.
Can you show us the code though?
import scratchattach as scratch3
session = scratch3.login("username", "password")[s][/s]
post = session.connect_post("post_id")
post.edit(new_content)