I really need help trying to run this Python script

I’m trying to run this script called “Great Suspender Restore URLS” in order to, well, restore the broken Great Suspender links to my tabs from my Google Chrome session, the windows of which have been exported into a JSON file. Now, the instructions from GitHub appear to be quite simple, & I was successfully able to download & install the Great Suspender Restore URLs Python package, but I have had NO luck getting the actual script to work so that my links can actually be restored.

I tried fixing the environment variables by adding a user path to the folder where Python itself is located, but the Python terminal gives me “Invalid Syntax”. I have the list of tabs located in the “Great Suspender Restore URLs” subfolder in ‘Python – Scripts’, & I try to run the script that I need to fix said list, but it’s not working. I don’t know how to type in the path where the GSRU script is, & I still don’t have any luck when I try out path-&-file input methods mentioned on other websites. And I’m certain there’s several other methods I tried, but I can’t remember any of them – that’s how long I’ve been running myself ragged trying to run this one simple script! Here’s some illustrative screencaps that should elucidate my troubles pertaining to what I’m trying to accomplish.

I have pictures uploaded here:
json - I’m trying to run a Python script to restore broken links in my Google Chrome session - Stack Overflow

(NOTE: Nobody has answered my post on StackOverflow so far, & I’m really impatient to figure this problem out, so I thought I would have better luck here.)

If anyone would like to see any more screenshots, I’ll add them. :slight_smile:

So, can anyone kindly help me, please? :slight_smile:

Answered on SO. You must enter Command Prompt commands in a Command Prompt window. Python only executes python statements.

Hi, Stack Overflow regular here. As a heads up, questions like this one are not appropriate for Stack Overflow. The key point is that SO is for questions about programming, not about using someone else’s program. The fact that it’s written in Python doesn’t make this a programming question - every program is written in some programming language - and this program isn’t a tool that you would use to help write other programs, it’s just something to help clean up your web browser’s data.

We also don’t normally want images on Stack Overflow for anything that doesn’t absolutely need an image to be understood. In particular, programmers should normally have a basic understanding of how paths work on their computer, so they would be able to copy and paste the text versions of the paths (usually we format these like single-line code, because it’s text that you would see in a terminal window).

As it happens, the underlying problem you encountered is one for which we have a reference question: as Terry explained, the Python interpreter is separate from the command line. (The reference question shows a very different command, but it’s the same conceptual problem.) So I have closed the question as a duplicate to get it out of the way.

Finally:

(NOTE: Nobody has answered my post on StackOverflow so far, & I’m really impatient to figure this problem out, so I thought I would have better luck here.)

Yes, here is the right place for such a question, not Stack Overflow. Aside from the topic itself, Stack Overflow is not a discussion forum and especially not a tech support forum; and we don’t care about your deadlines - we are trying to build a high-quality Q&A reference library. We also want questions to be written in a more direct style, if possible (if it were on topic, I would edit it to show you).

Well, I have written questions more appropriate for StackOverflow. :slight_smile: I just didn’t know that my latest question wasn’t one of them. ^^;; I’m actually feeling a little embarrassed now.

Well, that’s the thing – on other pages that I consulted to try & solve the problem myself, I kept encountering conflicting language & methods that either involved Command Prompt, Python, or both. And several of these pages used the exact phrase “command line”, so I was additionally confused; I mean, like, are you referring to Command PROMPT, or something in Python that I’m not understanding?

So, I need to run all these commands in Command Prompt, I presume? And…is there anything else I’m required to do? Because I’m sure I’m missing a lot of those – for instance, how to properly tell Command Prompt where my “Great Suspender Restore URLs” script & JSON tabs list are located. Would you &/or anyone else care to enlighten me on that? :slight_smile:

“command line” means the system’s command prompt. The Python REPL (interpreter prompt) is not a “command line”, because the things you type there are not “commands” - they are code, which consists (roughly speaking) of statements and expressions.

If you want to use Python to write your own code, it is a good idea to get familiar with what Python code looks like, and what commands for the command line look like. They are quite different, and it will take only a little practice before it’s obvious what’s what.

In the example you highlighted, see where it says --in-file=tabs.json ? That is the part you use to explain where the JSON tabs list is. If it’s in the current directory, you can just put the name; otherwise you will need to specify a path (either absolute or relative).

You do not need to tell the Command Prompt where the script is - when you installed it, pip will have copied it to a place that your system will automatically look for programs, when you use their name for a command (like restore-the-great-suspender-urls, in the example). These places are listed in an environment variable called PATH. When you install Python, the Python installer will add a folder path from inside the Python installation to the PATH; and when pip installs programs (i.e., if the package has an entry point script), it will put them in that path.

It will be better if you study a command-line tutorial to understand the fundamentals here.

1 Like

OK, that helps a lot! :slight_smile: Many thanks! :smiley:

Though I’m still a little confused…In that case, what’s the best command-line tutorial online that you would recommend? :slight_smile: (Preferably one with text &/or images, if that’s all right.)

Also, I took the advice of another site, & changed the path directory from my Python folders in AppData/Local/Programs/Python, instead of the Python section in Programs(x86). Would that affect what I’m trying to do in any way?

If you could respond to my latest reply soon, that would be great. :slight_smile:

Everyone here is volunteering their own personal free time. There is no SLA for responses.

Sorry about that… :disappointed_relieved:

Well, in the interim, I can use help from anyone & everyone available, so would anyone else like to answer my latest questions? :slight_smile: If so, that would be very much appreciated. :slight_smile:

UPDATE: I learned how to get into Python through command prompt! :slight_smile:

Now, I’m gonna try & do the rest of my task! :smiley: Wish me luck! :slight_smile: And if I need further help, I’ll consult you through this thread again. :slight_smile:

Well, I tried to run the code again…& it still didn’t work. :frowning:

I know there’s still something else I need to do to get the script to finally run, but what? (shrugs)

Again: the command goes at the command line, not within Python. Do not first run python before running the script. When it says C:\Users>, you should use cd commands in order to go into the folder that contains tabs.json, and then use the restore-the-great-suspender-urls command. Do not use the python command at any point in this process.

1 Like

OK, thanks! :slight_smile: I’ll try again, & it should work this time! :smiley:

I’ve taken your advice so far, but there’s still one more hurdle I have to deal with. :frowning:

How do I fix the “User is not identified…” issue?

Do not type the User> part. When you see C:\Users>, start typing the command right away.

1 Like

Tried it…& there’s still another problem! (frustrated sigh)

So, what’s the issue now, I wonder?

Repeating the important part, with emphasis:

OK, let me see if I got it right this time before I run the commands:

(I presume I need to take control as administrator, then switch from System32 to my Users folder, as I’ve done before)

First type:
C://Users> cd Python311/Scripts

Then type:
restore-the-great-suspender-urls --in-file=tabs.json --out-file=tabs-restored.json

Hopefully, I’m not missing anything else or doing something incorrect?