brigadier icon indicating copy to clipboard operation
brigadier copied to clipboard

No such file or Directory

Open zacharytam-0411 opened this issue 2 years ago • 8 comments

The code is like this:

Last login: Thu Nov 17 21:26:41 on ttys000 zacharytam0411@Zachary-Macbook ~ % cd Desktop/brigadier-main zacharytam0411@Zachary-Macbook brigadier-main % ./brigadier env: python: No such file or directory zacharytam0411@Zachary-Macbook brigadier-main %

zacharytam-0411 avatar Nov 17 '22 13:11 zacharytam-0411

i am using MacBookAir10,1 Mac OS 13.0.1

zacharytam-0411 avatar Nov 17 '22 14:11 zacharytam-0411

Hey...I have the same problem, did you find the solution?

wilfredBabuu avatar Dec 21 '22 07:12 wilfredBabuu

Um... Not yet

zacharytam-0411 avatar Dec 21 '22 10:12 zacharytam-0411

same issue here, commenting to see if a solution comes...

TommyH-Tran avatar Jan 23 '23 07:01 TommyH-Tran

Hey, I found a solution. Although it looks like the error is stating there's an issue with this program's file, it's a symlink issue! I ran python in the terminal and saw bash: python: command not found I noticed that python didn't have a specified path by running whereis python and receiving python: Therefore, I knew there was an issue with my env variable PATH. I fixed the issue by installing pyenv, which is built exactly for this type of issue. The steps are quite complicated. So, I've outlined everything in regard to preparing for installation and subsequently using the program to solve our issue, with solutions to problems that may arise as well:

  1. Installation as listed on page brew update brew install pyenv
  2. Check which shell config file you need to edit (bash or zsh) echo $0 If you get zsh, you need to edit .zshrc. Otherwise, if you get bash, .bashrc cd ~ ls -a Search for file .bashrc or .zshrc.
  3. For .bashrc file
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc

Check the existence of ~/.profile, ~/.bash_profile or ~/.bash_login by usingcd ~ then ls -a and searching for them. if you have any of these, then execute the three commands above, but replace the specified config file with the relevant profile file. for example, if you have ~/.profile,

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init -)"' >> ~/.profile

if you have none of these files, confirm you are in the home directory by typing cd ~ and using the bash shell using the method described in step 2. If you lack the file, usetouch .profile as well as echo export BASH_SILENCE_DEPRECATION_WARNING=1 > .profile and run the above set of commands. It's highly recommended by pyenv to add these to a profile file for Bash, due to the wide array of Bash startup files. 4. Commands for altering .zshrc file These commands allow you to edit the .zshrc file to use the pyenv command without using vim, nano, etc. to edit the config files.

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

For noninteractive login shells, check the existence of ~/.zprofile or ~/.zlogin and add the commands there. Discover them using the steps outlined in the Bash steps above. However, this step is not encouraged like it is with Bash, it's simply up to you. 6. Directly from pyenv: "OPTIONAL. To fix brew doctor's warning ""config" scripts exist outside your system or Homebrew directories" For this issue, use command: alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew' 7. Restart shell exec "$SHELL" 8. Install dependencies for python If you haven't, install Xcode Command Line Tools using xcode-select --install and Homebrew using /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Then you can install all of the dependencies for Python using brew install openssl readline sqlite3 xz zlib tcl-tk 9. Install! Check all current versions of python available for installation using pyenv install -l. At the time of writing, the latest stable release is 3.11.2. You will want to change your global python version to python3, or else you will run into issues with a lot of applications pyenv install 3.11.2 pyenv global 3.11.2 These two commands install the 3.11.2 version of python, to be used globally across your user account (as opposed to a single session or directory). However, if you try to use Python3 with brigadier, you'll run into an issue...

  File "/Users/[USERNAME]/Downloads/brigadier-main/./brigadier", line 26
    print "%s\n" % msg
    ^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

Quotes for a print statement are the issue as Python 2.7 and before uses print "statement" instead of print("statement"). Therefore, you will want to install python 2.7 and configure it locally (specific to a single directory). Considering that you will run into issues using python 2.7 instead of python 3, it's important that you do not configure it globally. Navigate to the directory containing the brigadier executable (the program file), which should be something like brigadier-main, and execute the following: pyenv install 2.7 pyenv local 2.7 These two commands will ensure you use python 2.7 within the brigadier file. 10. run pyenv versions You should get a result with an asterisk next to 2.7 and your current location (in the brigadier file). If so, you did everything right! 10. Test by using command python If the problem is fixed, the interactive shell will initiate. You can then type exit() to leave. 12. Attempt to run, requests module error If you run the program, you may get this error:

Traceback (most recent call last):
  File "./brigadier", line 14, in <module>
    import requests
ImportError: No module named requests

I found a solution and it's simple, just run pip install requests from the terminal. 13. Attempt to run again... and... Awesome! Brigadier works!

glitcharc avatar Mar 22 '23 11:03 glitcharc

I still don't understand.... can you make a video about this? Thanks

zacharytam-0411 avatar Mar 22 '23 14:03 zacharytam-0411

I still don't understand.... can you make a video about this? Thanks

Okay, sure. I'll share it here once I make it.

glitcharc avatar Mar 22 '23 23:03 glitcharc

I still don't understand.... can you make a video about this? Thanks

https://www.youtube.com/watch?v=Bw3s6Xa1jlQ

glitcharc avatar Mar 24 '23 22:03 glitcharc