ninia / jep

Embed Python in Java
Other
1.32k stars 150 forks source link

Build fails on OSX with python3.7: missing import in jet/commands/scripts.py #381

Closed seletz closed 2 years ago

seletz commented 2 years ago

Describe the problem

Build fails on osx against python 3.7 after compilation because of a missing import. This occurs on both the pypi released version and git master.

Search for existing solutions No existing issue found. Will create a PR for this.

Environment:

$ uname -a
Darwin NewEden 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64
$ python --version
Python 3.7.6
$ java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

Otherwise clean virtual env.

Logs

creating build/scripts-3.7
Traceback (most recent call last):
  File "setup.py", line 138, in <module>
    'test': test,
  File "/Users/seletz/.pyenv/versions/3.7.6/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/seletz/.pyenv/versions/3.7.6/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Users/seletz/.pyenv/versions/3.7.6/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/seletz/.pyenv/versions/3.7.6/lib/python3.7/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/Users/seletz/.pyenv/versions/3.7.6/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Users/seletz/.pyenv/versions/3.7.6/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/seletz/develop/research/jep/jep/commands/scripts.py", line 50, in run
    self.copy_scripts()
  File "/Users/seletz/develop/research/jep/jep/commands/scripts.py", line 82, in copy_scripts
    context['pythonexecutable'] = 'export PYTHONEXECUTABLE = %s' % sys.executable
NameError: name 'sys' is not defined

Additional context None.

ndjensen commented 2 years ago

Thank you for finding this, tracking it down, reporting it, and fixing it!