In the document, it said all the script's dependency should copy along to
the directory.
Do all python lib scripts need to copy as well?

We tried to run one script with sandbox and observed the below errors:

'import site' failed
Traceback (most recent call last):
  File "<builtin>/app_main.py", line 75, in run_toplevel
  File "/tmp/twoTagCombination.py", line 2, in <module>
    import hashlib
  File "/bin/lib-python/2.7/hashlib.py", line 149, in <module>
    import logging
  File "/bin/lib-python/2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref,
collections
ImportError: No module named time
[Subprocess exit code: 1]

We didn't put hashlib.py to the direcoty, but it looks like sandbox is able
to find hashlib.py.
However, it miss the dependency of "time" module.
How shall we solve the issue?

On Mon, May 18, 2015 at 6:43 PM, Костя Лопухин <kostia.lopu...@gmail.com>
wrote:

> You can check sandbox like this:
> $ ../sandbox/pypy_interact.py pypy-c
> >>>> import os
> >>>> os.getcwd()
> '/tmp'
>
> As for the second failed command I think the correct usage will be
> (from the example here
> http://pypy.readthedocs.org/en/latest/sandbox.html#howto):
> pypy/sandbox/pypy_interact.py --tmp=/home/yicong.hyc/test/ ./pypy-c
> /tmp/twoTagCombination.py
>
> 2015-05-18 13:19 GMT+03:00 Yicong Huang <hengha....@gmail.com>:
> > Thanks for the answer!
> > As you mentioned, the generated "pypy-c" was acutally "pypy-c-sandbox".
> > But the binary had some problems to run:
> >
> > $./pypy-c
> > s ll_os.ll_os_getenv( s PYPY_GENERATIONGC_NURSERY
> > Fatal error during initialization: out of memory
> > Aborted
> >
> > Alternatively, we tried to run with pypy_interact.py:
> > pypy/sandbox/pypy_interact.py --tmp=/home/yicong.hyc/test/ ./pypy-c
> > /home/yicong.hyc/test/twoTagCombination.py
> >
> > 'import site' failed
> > Traceback (most recent call last):
> >   File "<builtin>/app_main.py", line 75, in run_toplevel
> > IOError: [Errno 2] No such file or directory:
> > '/home/yicong.hyc/test/twoTagCombination.py'
> > [Subprocess exit code: 1]
> >
> > Why the subprocess could not find the python script? We did check that
> the
> > python script exist.
> >
> > On Mon, May 18, 2015 at 5:07 PM, Костя Лопухин <kostia.lopu...@gmail.com
> >
> > wrote:
> >>
> >> At least in pypy 2.3.1 pypy-c *is* the sandbox, there is no
> >> pypy-c-sandbox produced.
> >>
> >> 2015-05-18 6:54 GMT+03:00 Yicong Huang <hengha....@gmail.com>:
> >> > I followed the document to build pypy-c-sandbox based on souce code
> >> > 2.5.1:
> >> >
> >> > rpython/bin/rpython -O2 --sandbox pypy/goal/targetpypystandalone.py
> >> >
> >> > In the stdout, I did observe sandbox option is true:
> >> >
> >> > [translation] [translation]
> >> > [translation]     check_str_without_nul = True
> >> > [translation]     gc = generation
> >> > [translation]     gcrootfinder = shadowstack
> >> > [translation]     gctransformer = framework
> >> > [translation]     list_comprehension_operations = True
> >> > [translation]     rweakref = True
> >> > [translation]     sandbox = True
> >> > [translation]     shared = True
> >> > [translation]     thread = False
> >> > [translation]     withsmallfuncsets = 5
> >> >
> >> > However, after the build process completed, only pypy-c generated and
> I
> >> > did
> >> > not find pypy-c-sandbox.
> >> >
> >> > [platform:execute] make -j 5 in /tmp/usession-master-16/testing_1
> >> > [platform:WARNING] pypy_module__warnings_interp_warnings.c: In
> function
> >> > ‘pypy_g_normalize_module’:
> >> > [platform:WARNING] pypy_module__warnings_interp_warnings.c:8565:5:
> >> > warning:
> >> > assuming signed overflow does not occur when assuming that (X - c) > X
> >> > is
> >> > always false [-Wstrict-overflow]
> >> > [translation:info] copied: /home/yicong.hyc/odps-pypy/libpypy-c.so
> >> > [translation:info] usession directory: /tmp/usession-master-16
> >> > [translation:info] created: /home/yicong.hyc/odps-pypy/pypy-c
> >> > [1ebe2] translation-task}
> >> > [Timer] Timings:
> >> > [Timer] annotate                       ---  309.6 s
> >> > [Timer] rtype_lltype                   ---  355.1 s
> >> > [Timer] backendopt_lltype              ---  179.8 s
> >> > [Timer] stackcheckinsertion_lltype     ---   17.5 s
> >> > [Timer] database_c                     ---  208.2 s
> >> > [Timer] source_c                       ---  179.9 s
> >> > [Timer] compile_c                      ---  102.6 s
> >> > [Timer] ===========================================
> >> > [Timer] Total:                         --- 1352.7 s
> >> >
> >> > Grep "sandbox" in the log, there were some warnings, but no errors:
> >> >
> >> > [sandbox:WARNING] Not Implemented: sandboxing for external function
> >> > 'RPython_StartupCode'
> >> > [sandbox:WARNING] Not Implemented: sandboxing for external function
> >> > 'pypy_debug_catch_fatal_exception'
> >> > [sandbox:WARNING] Not Implemented: SomeImpossibleValue()
> >> > [sandbox:WARNING] Not Implemented: SomeImpossibleValue()
> >> > [sandbox:WARNING] Not Implemented: sandboxing for external function
> >> > 'clock_gettime'
> >> > [sandbox:WARNING] Not Implemented: sandboxing for external function
> >> > 'clock_getres'
> >> > [sandbox:WARNING] Not Implemented: sandboxing for external function
> >> > 'fcntl'
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > pypy-dev mailing list
> >> > pypy-dev@python.org
> >> > https://mail.python.org/mailman/listinfo/pypy-dev
> >> >
> >
> >
>
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to