问题描述
我正在尝试使用以下代码在 Jupyter Notebook 单元中执行二进制文件。 它们来自已被证明有效的示例代码。
@commands.command(aliases=['ub'])
@commands.has_guild_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
async def unban(ctx,member: discord.User = None,*,reason=None): # discord.User allows you to use discord ID/discordname#discriminator (674670744776474644 or Mystery R#6892)
if reason is None:
reason = f"{ctx.author.name}#{ctx.author.discriminator} did not provide any reason"
if member is None:
await ctx.send("Please write a ID#discriminator to unban")
x = len(reason)
if x > 460: # 460 is the character limit of the reason in discord
return await ctx.send('Reason must be less or equal to 460 characters')
else:
await ctx.guild.unban(member,reason=reason) # add the response from bot after members are unbanned yourself after this line
@unban.error
async def unban_error(self,ctx,error):
if isinstance(error,commands.MemberNotFound):
await ctx.send("No member was found with the given argument")
elif isinstance(error,commands.BotMissingPermissions):
await ctx.send("Bot is missing Ban Members permission(s) to run this command.")
elif isinstance(error,commands.MissingPermissions):
await ctx.send("You are missing Ban Members permission(s) to run this command.")
但是,会打印以下错误消息。
os.system("hprep96 -M %s.d -d %s -HS %.4f -HR 0 -EQEX"%(model,dfile_out,depth))
!hspec96
!hpulse96 -D -i > file96
!f96tosac -B file96
我对错误的猜测是二进制文件的路径未包含在 Jupyter Notebook 的环境中。
事实上,我在脚本 sh: hprep96: command not found
/usr/bin/sh: hspec96: command not found
/usr/bin/sh: hpulse96: command not found
/usr/bin/sh: f96tosac: command not found
中更新了这些文件的路径,如下所示:
~/.bashrc
因此,只需在终端中键入这些二进制文件即可很好地执行。但是,我想使用我之前编写的命令从 Jupyter Notebook 单元执行它们。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)