Reputation: 497
My system is 5.0.9-2-MANJARO
I've already set the python scripts workaround described in archwiki
➜ ~ cat /home/nfl/bin/python
#!/bin/bash
script=$(readlink -f -- "$1")
case "$script" in (/opt/cocos2d-x/*)
exec python2 "$@"
;;
esac
exec python3 "$@"
➜ ~ which python
/home/nfl/bin/python
➜ ~ echo $PATH
/home/nfl/.nvm/versions/node/v10.15.3/bin:/home/nfl/bin:/usr/local/bin:/opt/cocos2d-x/tools/cocos2d-console/bin:/opt/cocos2d-x/tools/cocos2d-console/plugins/plugin_package:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin
➜ ~
When I run python script that output current python version, it output python2 in directory specified in the script(/opt/cocos2d-x/*) and python3 in non specified dir. So everything work fine now.
The problem is when I try to run sdkbox(cocos2d plugin) with PATH, it seem like python3 is used instead of python2.
➜ ~ which sdkbox
/opt/cocos2d-x/tools/cocos2d-console/plugins/plugin_package/sdkbox
➜ ~ sdkbox
RuntimeError: Bad magic number in .pyc file
➜ ~
But when I run it directly from the directory, it works
➜ plugin_package pwd
/opt/cocos2d-x/tools/cocos2d-console/plugins/plugin_package
➜ plugin_package ./sdkbox
_______ ______ _ _ ______ _____ _ _
|______ | \ |____/ |_____] | | \___/
______| |_____/ | \_ |_____] |_____| _/ \_
Copyright (c) 2016-2018 SDKBOX Inc. v1.0.2.8
usage: sdkbox [-h] [-v] [-p [PROJECT]] [-b [PLUGIN]] [-D SYMBOL] [-i INPUT]
[-o OUTPUT] [-q] [-d [DAYS]] [-l LEGACY] [--key KEY] [--dryrun]
[--forcedownload] [--noupdate] [--alwaysupdate] [--patcherrors]
[--nopatching] [--nopatchingcpp] [--jsonapi] [--forcecopy]
[--mkey MKEY] [--mvalue MVALUE] [--local] [--remote]
[--info INFO] [--runin RUNIN] [--apitoken APITOKEN]
[--silenttime SILENTTIME] [--projectpath PROJECTPATH]
[--platform PLATFORM]
{import,info,update,forget,restore,list,clean,symbols,version,set,tracking,encrypt,decrypt}
sdkbox: error: too few arguments
➜ plugin_package
What happen exactly and how to fix this?
Upvotes: 1
Views: 78
Reputation: 360
I would suggest using virtual environment for this purposes. virtualenv
Upvotes: 0
Reputation: 417
Shebang might be your solution. It addresses the python interpreter by the shebang.
Should I put #! (shebang) in Python scripts, and what form should it take?
Upvotes: 1