Command Line SQLite - errors

image

Hi,

I am trying to use SQLite, I think i have downloaded it onto my computer because i can find it by going through each file using cd, however when I try to use the commands that are suggested on https://www.codecademy.com/paths/data-science/tracks/analyze-data-sql-go-off-platform/modules/analyze-data-sql-learn-off-platform/articles/what-is-sqlite I get either “unexpected EOF when looking for matching” and “unexpected end of file”. I tried to then use the other command to refresh and it just said command not found.

As you can probably tell, I am a complete novice, so any help is appreciated to allow me to get past this part!

Thank you.

Hey there! Welcome to the forums :smiley:

As you can see, it’s outputting this message to you:

error: cannot start sqlite3: Not found in PATH

Which is basically telling you that you need to add sqlite3 as a new environment variable in your computer in order to be able to execute it. You basically always have to do that whenever you install something you wanna use in the command line. Now, I would post screenshots of the process but my computer is in Spanish…does that bother you or should I post them?

@net0433359574,

When using the command line you have to make sure you pay very close attention to what you are typing. If you have even one character wrong, things won’t work as you expect them to. Let me try to break it down for you so you understand why it didn’t work at each step.

Looking at your first command, you tried to run a file that doesn’t exist:
image
Instead, it should have been winpty ./sqlite3.exe since the file is called sqlite3 and not sqlite.

In the next two commands, you don’t add the file type at the end of the filename.


When you do this, bash will assume these are aliases. You can use aliases, but before you can you have to set those aliases up in your path, as @yizuhi mentioned.

Your ls command worked perfectly and showed you the contents of the directory, so no problems there. However, you then tried to use the cd command to opensqlite3.exe:


The cd command stands for “change directory” and can only be used on directories (folders), which is why you received an error telling you that sqlite3.exe is not a directory.

So, moving forward, if you want to open the file you will use the winpty ./sqlite3.exe.

If you want to set up an alias so you can open it from anywhere on your computer by using the sqlite3 command, then follow the Codecademy instructions at the link you provided, but you will want to put single quotes around ${PWD} since the path to that file has spaces in it:

echo "alias sqlite3=\"winpty '${PWD}'/sqlite3.exe\"" >> ~/.bashrc

source ~/.bashrc

Hope this helps clear some things up. Happy coding!

1 Like