Problem finding my folder via terminal

Cameron Simpson cs at cskk.id.au
Thu Jun 7 20:04:11 EDT 2018


Hi,

Replies inline below, which is the style we prefer on this list. (And to reply, 
please reply to the specific message, not your original post. This will let you 
pick up that branch of the conversation directly and not confuse your readers.)

On 07Jun2018 08:39, T Berger <brgrt2 at gmail.com> wrote:
>On Wednesday, June 6, 2018 at 12:19:35 PM UTC-4, T Berger wrote:
>> I’m learning Python on my own and have been stuck for two days trying to get modules I created into site-packages. As a trial step, we were asked to change directly into the folder containing our modules. I typed “cd mymodules” per instructions, but got this error message: “-bash: cd: mymodules: No such file or directory.” I saved mymodules to my documents. What is going wrong here?
>>
>> When I tried to create a distribution file, I typed “192:~ TamaraB$ mymodules$ python3 setup.py sdist.” I got this error message: “-bash: mymodules$: command not found.” What should I do?
[...snip...]
> “We'll need some more information about the computer you are using: what OS 
> are you using (Mac, Linux, Windows, something else), what shell are you 
> using, perhaps a file listing of your home directory. “
>
>I’m using Terminal in Mac Sierra (10.12.6).

Cool.

>“(I'm not sure what the 192 part means. Does that increase each time you type a command?) “
>
>I'm new to Terminal, but that 192 looked weird to me too. It doesn’t increase, just stays at 192. There is also a thin gray left bracket in front of the “192” which didn’t copy into my email. Is there some way to restore the default prompt in Terminal (and what is the default prompt)?

On a Mac, it tends to be like this: "{hostname}:~ {username}$ " where 
{hostname} is your Mac's name and {username} is your login name; that is called 
the "shell prompt", and "the shell" is the command line interpreter running the 
commands you type. On a Mac, this is usually bash, a UNIX Bourne shell.

There is a secondary prompt like this "> ". That indicates that you're typing a 
compond command, or at least that the shell believes you're typing a compond 
command, which is just a command which extends to more than one line. The 
common way to confuse the shell about this is to forget to close a quote - the 
shell expects that string to continue until it sees a closing quote.

You can leave the secondary prompt by typing Control-C (often denoted "^C").  
That will cancel the incomplete command and get you back to a clean empty 
primary prompt.

Note that if you start some interactive command, such as the interactive Python 
interpreter, you will then be dealing with _its_ prompts until you leave that 
command.

>Back to my problem. Your email helped me get into the mymodules folder, but I’m still stuck at the next step of the exercise, which is to get the module I created into site-packages. mymodules contains three files: the module we created, a setup file (setup.py), and a readme file. The line of text we were instructed to type into our terminal was: “python3 setup.py sdist.” In response, I got this error message: “/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory”.
>
>Why is this not working for me?

I would expect that your shell is not actually in the "mymodules" directory 
when you typed "python3 setup.py sdist". Usually your shell prompt includes the 
current working directory (the "~" in my example above, which is your home 
directory), which is a useful contextual clue.

You can also find out your current working directory by running the "pwd" 
command (the "print working directory" command).

The "ls" (list) command without arguments will list what is in the current 
directory, so you can now check (a) whether you're where you thought you were, 
and (b) what is in the current directory (in case it doesn't contain what you 
expected).

The "ls -la" command will provide a longer and more detailed listing too.

Let us know what you find out.

Cheers,
Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list