You are not logged in.

#1 2021-10-21 11:40:24

newsboost
Member
Registered: 2016-07-24
Posts: 102

[SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

Hi

I'm a zsh-noob. In my .zshrc config file I have ZSH_THEME="random". Today the random routine decided I should use the "emotty"-theme. But after starting a new terminal window I saw something like this:

/usr/share/oh-my-zsh/themes/emotty.zsh-theme:49: command not found: emotty

I found out I can reproduce the problem by running "zsh /usr/share/oh-my-zsh/themes/emotty.zsh-theme" and it says there's a problem in line 49. I googled the problem and found out that this theme needs the "emotty"-plugin as well as the "emoji"-ditto. So I appended those to my "plugins=(......) part of my ~/.zshrc file. Then started a new shell - thought the problem would disappear, but it didn't. Then I looked more careful and were unsure if I already had the emotty plugin or if I needed to do something extra to download or get it. Seems like I already have it, from this command:

yay -Ql oh-my-zsh-git  |grep -i emotty
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/README.md
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty.plugin.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty_emoji_set.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty_floral_set.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty_love_set.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty_nature_set.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty_stellar_set.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty_zodiac_set.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/themes/emotty.zsh-theme

yay -Ql oh-my-zsh-git  |grep -i emoji
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji-clock/
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji-clock/README.md
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji-clock/emoji-clock.plugin.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji/
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji/README.md
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji/emoji-char-definitions.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji/emoji-data.txt
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji/emoji.plugin.zsh
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emoji/update_emoji.pl
oh-my-zsh-git /usr/share/oh-my-zsh/plugins/emotty/emotty_emoji_set.zsh

I don't understand this problem. So I already have the needed plugins, right? What isn't it working?

Below is a simplified version of my ~/.zshrc (left out the comments and inactive config-part):

[[ $- != *i* ]] && return

alias ls='ls --color=auto'
# ====================================================
autoload -Uz compinit promptinit
compinit
promptinit

zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename '/home/mfj/.zshrc'

autoload -Uz compinit
compinit

HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=$HISTSIZE

export ZSH=/usr/share/oh-my-zsh
plugins=(
    archlinux
    colored-man-pages
    docker
    colorize
    tig
    git
    github
    git-prompt
    emoji
    emotty
)
ZSH_THEME="random"

source $ZSH/oh-my-zsh.sh

# Vim keys in zsh:
bindkey -v

# WARNING: You need this after "bindkey -v" or it won't work, with e.g. CTRL+T, ALT-C etc:
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh

I appreciate any suggestions/ideas and also wish to learn how to deal with this in the future, if it happens again, thanks!

Last edited by newsboost (2021-10-22 15:16:31)

Offline

#2 2021-10-21 12:41:00

seth
Member
Registered: 2012-09-03
Posts: 25,133

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

https://github.com/ohmyzsh/ohmyzsh/blob … .zsh-theme

user_prompt="$(emotty)"
type emotty
echo $plugins

The canonical suggestion is to not use OMZ.
Search the forum on why, but the short version is that it's FUBAR.

Also

simplified version of my ~/.zshrc

don't do that - it means you and everyone else are operating on different data and it has happened more often than never that an error was redacted out…

Offline

#3 2021-10-21 20:42:16

newsboost
Member
Registered: 2016-07-24
Posts: 102

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

Sorry, I don't understand this link. It says "Latest commit 8e1cfc9 on Apr 15, 2018" - is that interesting? Please forgive me if it's a stupid question...

seth wrote:
user_prompt="$(emotty)"
type emotty
echo $plugins

Sorry, this I also don't understand: I have looked into the emotty-file and the first line "user_promt" is found there. I'm assuming I should type the 2 other commands and post the result here, so I'll just do that:

$ type emotty
emotty is a shell function from /usr/share/oh-my-zsh/plugins/emotty/emotty.plugin.zsh

$ echo $plugins
archlinux colored-man-pages docker colorize tig git github git-prompt emoji emotty

So this looks correct, doesn't it?

seth wrote:

The canonical suggestion is to not use OMZ.
Search the forum on why, but the short version is that it's FUBAR.

Also

simplified version of my ~/.zshrc

don't do that - it means you and everyone else are operating on different data and it has happened more often than never that an error was redacted out…

1) hmm... But there are so many people using OMZ. This is the only problem I've had... About OMZ being FUBAR: It seems a lot of people are happy with it - or at least have it installed: "aur/oh-my-zsh-git r6192.be4a95297-1 (+425 2.31)" - it's currently not enough for me to abandon it but ofcourse it's nice to hear that I should consider uninstalling it so I'll have it in the back of my head in the future and if too many things are broken I'll uninstall it.

2) About the simplified version of the ~/.zshrc: I understand your concern. But I've verified that the issue persists when I replace my ~/.zshrc file with what I posted, so I think it's good practice to not post a lot of irrelevant garbage from config-files. Everyone should be able to reproduce the problem using the simplified .zshrc-file as I've verified that the issue is still there when I use exactly that file. So OMZ is broken and apparantly it isn't me. I tried to check in the issues-list on https://github.com/ohmyzsh/ohmyzsh/issu … pen+emotty and I don't see any. Maybe the correct thing to do is to create an issue? It's strange... I just played a bit with it:

# Error in script:
 $ zsh  /usr/share/oh-my-zsh/themes/emotty.zsh-theme
/usr/share/oh-my-zsh/themes/emotty.zsh-theme:49: command not found: emotty

# Verify that zsh is being used on the script: Yep, it's correct, as written in first line:
 $ head -1 /usr/share/oh-my-zsh/themes/emotty.zsh-theme
#!/usr/bin/env zsh

# Extract line 49 from script, which is wrong and causes a script-error when being run:
 $ sed -n '49,49p' /usr/share/oh-my-zsh/themes/emotty.zsh-theme
user_prompt="$(emotty)"

# Try reproducing the problem on command-line. Expected to see an error, but no problems here, it works, I see the emotty-icon as output!:
 $ echo emotty="$(emotty)"
emotty=?️
# Problem is not reproduced on command-line? Why? That's strange, isn't it?

(you can't see the emotty-icon, I copy/pasted from the cmd-line output, but it's really there instead of the "?" which you see here)...
Didn't I just do exactly the same as the script, on the command-line but didn't get any problems? The same command being run from inside a script is however a problem, isn't this weird? What is going on, I don't understand or don't get it?

Offline

#4 2021-10-21 20:48:59

seth
Member
Registered: 2012-09-03
Posts: 25,133

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

1. is the reference to the error yielding file for context
2. looks correct so I'm not sure how you can end up w/ "command not found: emotty" - the context and your recent findings suggest that OMZ tries to set the theme before sourcing the plugins… because it's OMZ. F.U.B.A.R.
3. And so many people showin up here w/ their zsh doing weird stuff and being completely broken and at the end of the thread, they remove OMZ. Feel free to search the forum.

So OMZ is broken and apparantly it isn't me.

You'll get to the wisdom of those words.

Offline

#5 2021-10-21 21:05:40

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,748
Website

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

The problem with OMZ is that it takes a wonderful, modern* shell, and turns it into a bloated dumpster fire. You installed Arch presumably because you wanted control over your own system, so why surrender it straight out of the gate by ruining your shell, the heart of an Arch system?

Vanilla Zsh is fine. Some simple enhancements can make it superb. OMZ is like pouring a jug of mayonnaise onto a rare sirloin and thinking you are eating haute cuisine; newsflash - you aren't, you are just a short waddle away from shitting your pants.


* Yeah, I said "modern" tongue


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2021-10-21 21:45:23

newsboost
Member
Registered: 2016-07-24
Posts: 102

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

seth wrote:

1. is the reference to the error yielding file for context
2. looks correct so I'm not sure how you can end up w/ "command not found: emotty" - the context and your recent findings suggest that OMZ tries to set the theme before sourcing the plugins… because it's OMZ. F.U.B.A.R.
3. And so many people showin up here w/ their zsh doing weird stuff and being completely broken and at the end of the thread, they remove OMZ. Feel free to search the forum.

So OMZ is broken and apparantly it isn't me.

You'll get to the wisdom of those words.

3) Okay, I might uninstall it later.
2) I think it's something shell-related. See this:

 $ cat test.zsh
#!/usr/bin/env zsh
set -x
echo emotty="$(emotty)"

# The definition of emotty:
 $ which emotty
emotty () {
	local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
	local tty=${${(%):-%l}##pts/}
	(( tty = (tty % ${#${=emotty}}) + 1 ))
	local character_name=${${=emotty}[tty]}
	echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
}

# test.zsh has executable bit set
 $ ./test.zsh
+./test.zsh:3> emotty
./test.zsh:3: command not found: emotty
+./test.zsh:3> echo 'emotty='
emotty=

I'm thinking that maybe functions doesn't work inside a script but if "emotty" instead of a function was an exported variable it should work (only a theory) - see here:

 $ export testVar='what the fuck?' 
 $ export testFunc(){ echo "pwd=$(pwd)" }

# Verify export:
 $ which testFunc
testFunc () {
	echo "pwd=$(pwd)"
}

# New test-script:
 $ cat test2.zsh
#!/usr/bin/env zsh
echo testVar="$testVar"
echo testFunc="$(testFunc)"

# Run test #1 from the shell: - WORKING
 $ echo "testVar=$testVar"
testVar=what the fuck?
 $ testFunc
pwd=/home/user

# Run test #2 from the script - WORKING FOR THE EXPORTED VARIABLE, BUT NOT WORKING FOR THE EXPORTED FUNCTION:
 $ ./test2.zsh
testVar=what the fuck?
./test2.zsh:4: command not found: testFunc
testFunc=

Conclusion:
I think in this case, the error those zsh-guys did is understandable (but they could/should've tested things more carefully)...I notice that exported functions does not become inherited and passed into scripts - unlike variables do.... That's weird. Some kind of shell-stuff-logic that I'm unaware of is apparantly going on? Please don't post more "delete/uninstall zsh", I get your point and might do it later, right now there's also a lesson about "inheritance of exports" in relation to shell-functions here, I think...

Offline

#7 2021-10-22 06:40:47

seth
Member
Registered: 2012-09-03
Posts: 25,133

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

You cannot export functions (certainly not this way, bash and zsh have proprietary ways to carry them over) and I'd desperately assume that OMZ at least understands that and (somehow) sources the plugins into the shell (which is evidenced by your own findings and that is where the PS1 will need them)

This is an execution order thing, though https://github.com/ohmyzsh/ohmyzsh/blob … -my-zsh.sh has the theme setting after the plugin sourcing.
The variables in the script sound like it's intending to use FPATH, so check

echo $FPATH

Before we keep shitting on OMZ (as much as it's deserved), do you still get the error when starting zsh or is that from your synthetic "I run the theme as a script" test only?

Offline

#8 2021-10-22 13:20:23

newsboost
Member
Registered: 2016-07-24
Posts: 102

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

seth wrote:

The variables in the script sound like it's intending to use FPATH, so check

echo $FPATH

Good points there, thanks. I'm a bit confused now. You asked about FPATH so I did 2 experiments and wrote out the value:

# --- #1 ---
# Creating a new test-script from the terminal:
$ cat test3.zsh
#!/usr/bin/env zsh
echo $FPATH

$ ./test3.zsh
/usr/local/share/zsh/site-functions:/usr/share/zsh/site-functions:/usr/share/zsh/functions/Calendar:/usr/share/zsh/functions/Chpwd:/usr/share/zsh/functions/Completion:/usr/share/zsh/functions/Completion/Base:/usr/share/zsh/functions/Completion/Linux:/usr/share/zsh/functions/Completion/Unix:/usr/share/zsh/functions/Completion/X:/usr/share/zsh/functions/Completion/Zsh:/usr/share/zsh/functions/Exceptions:/usr/share/zsh/functions/Math:/usr/share/zsh/functions/MIME:/usr/share/zsh/functions/Misc:/usr/share/zsh/functions/Newuser:/usr/share/zsh/functions/Prompts:/usr/share/zsh/functions/TCP:/usr/share/zsh/functions/VCS_Info:/usr/share/zsh/functions/VCS_Info/Backends:/usr/share/zsh/functions/Zftp:/usr/share/zsh/functions/Zle


# --- #2 ---
# echo FPATH just from the shell (not from within a script):
$ echo $FPATH
/usr/share/oh-my-zsh/plugins/emotty:/usr/share/oh-my-zsh/plugins/emoji:/usr/share/oh-my-zsh/plugins/git-prompt:/usr/share/oh-my-zsh/plugins/github:/usr/share/oh-my-zsh/plugins/git:/usr/share/oh-my-zsh/plugins/tig:/usr/share/oh-my-zsh/plugins/colorize:/usr/share/oh-my-zsh/plugins/docker:/usr/share/oh-my-zsh/plugins/colored-man-pages:/usr/share/oh-my-zsh/plugins/archlinux:/usr/share/oh-my-zsh/functions:/usr/share/oh-my-zsh/completions:/home/martin/.cache/oh-my-zsh/completions:/usr/local/share/zsh/site-functions:/usr/share/zsh/site-functions:/usr/share/zsh/functions/Calendar:/usr/share/zsh/functions/Chpwd:/usr/share/zsh/functions/Completion:/usr/share/zsh/functions/Completion/Base:/usr/share/zsh/functions/Completion/Linux:/usr/share/zsh/functions/Completion/Unix:/usr/share/zsh/functions/Completion/X:/usr/share/zsh/functions/Completion/Zsh:/usr/share/zsh/functions/Exceptions:/usr/share/zsh/functions/Math:/usr/share/zsh/functions/MIME:/usr/share/zsh/functions/Misc:/usr/share/zsh/functions/Newuser:/usr/share/zsh/functions/Prompts:/usr/share/zsh/functions/TCP:/usr/share/zsh/functions/VCS_Info:/usr/share/zsh/functions/VCS_Info/Backends:/usr/share/zsh/functions/Zftp:/usr/share/zsh/functions/Zle

If you scroll to the right, you see the output is different from the 2 experiments:

It confuses me that the output is different but I think this might explain something important. First: Why is the FPATH different (sorry, probably a noob question, gotta ask)? Second, I remember I did change my zsh-config after I initially saw the problem and I haven't rebooted since then. I suspect if I reboot, the FPATH might be different because I have a theory that says that the short FPATH is from before I added "emoji" and "emotty" plugins to my ~/.zshrc. It makes sense that FPATH increases, with more plugins. So I'm thinking that when I run the script and do "echo $FPATH" it inherits the environment from when my window manager was started (= before "emoji" and "emotty" plugins were added) and *NOT* from the shell I'm standing in an running the script from, is this a correct assumption? That's counter-intuitive to me... I thought it would inherit the environment from the shell that started the script, including FPATH? Weird... I'm confused about how environment variables are inherited, because obviously a script does not inherit variables from the shell that just started the script (the test3.zsh-output vs. the output from the shell directly)?

seth wrote:

do you still get the error when starting zsh or is that from your synthetic "I run the theme as a script" test only?

Again, I thought it was the same. But once again, I've learned something new: If I change my zsh-config like this:

#ZSH_THEME="random"
ZSH_THEME="emotty"

Then "emotty" actually works, when I spawn a new shell from inside my window manager.

The problem with the random theme is that (at least with my skills), it's REAAAALY tedious to debug something that only randomly happens in rare cases - and that's why I tried to run emotty manually. At first I guessed that there's a problem with the "/usr/share/oh-my-zsh/themes/random.zsh-theme"-file and not actually with the "emotty"-file. By looking into that file I can see there's a variable called ZSH_THEME_RANDOM_CANDIDATES - ideally that should disqualify emotty, when I hadn't got the necessary plugins (=emotty and emoji) loaded while using the "random"-theme. So that's probably a bug. Now about the reason for this command not working:

$ zsh  /usr/share/oh-my-zsh/themes/emotty.zsh-theme
/usr/share/oh-my-zsh/themes/emotty.zsh-theme:49: command not found: emotty

So it's a spawned shell from the window manager: My guess is that it for some weird (?) reason, didn't inherit the extra new plugins from my ~/.zshrc, corresponding to the window manager's environment variable? Maybe it'll work after a reboot? It's not really a zsh or OMZ-issue anylonger, now I'm just trying to understand this "variable inheritance shell"-stuff, after that I'll mark the thread solved - I hope some of you can/will help me understand this "shell-phenomena", it confuses me and seems counter-intuitive... You don't need zsh or OMZ - see the top 2 experiments and I think there's an analogy between that and the reason for my failed attempts at running "zsh  /usr/share/oh-my-zsh/themes/emotty.zsh-theme" and it's got something to do with what I call "environment variable inheritance" (but I'm probably not using the correct terminology, please forgive me for that)...

Offline

#9 2021-10-22 13:41:47

seth
Member
Registered: 2012-09-03
Posts: 25,133

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

Then "emotty" actually works, when I spawn a new shell from inside my window manager.

The original problem was down to the missing plugin, the rest to your synthetic test not reflecting the actual problem.

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#10 2021-10-22 13:48:53

Raynman
Member
Registered: 2011-10-22
Posts: 1,338

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

FPATH is not normally exported to the environment and .zshrc is only for interactive shells, see https://wiki.archlinux.org/title/Zsh#St … down_files

Offline

#11 2021-10-22 15:15:40

newsboost
Member
Registered: 2016-07-24
Posts: 102

Re: [SOLVED] "oh-my-zsh/themes/emotty.zsh-theme:49: command not found"

@seth: Right, the synthetic test didn't reflect the problem but it was introduced because of the "randomness" in the init-file, so it's not completely insane to discuss, I think. But we're over that now, I'll mark as solved now, thanks for your valuable help, things are much more clear now!

@raynman: Thanks a lot for the reference, now it makes sense to me: Because I usually start my window manager from an interactive login shell, I also source some stuff that I don't want to be sourced there. So now I inserted "[[ -o login ]] && return" some lines below the usual "[[ $- != *i* ]] && return" and this hopefully makes my environment more understandable to me in the future, thanks a lot for pointing out, it's very helpful!

Offline

Board footer

Powered by FluxBB