beeware / batavia

A JavaScript implementation of the Python virtual machine.
http://pybee.org/batavia
Other
1.39k stars 424 forks source link

Windows - python manage.py runserver fails with Cannot import pystone #731

Closed kosiew closed 6 years ago

kosiew commented 6 years ago

==first timer==

I am trying to set up the batavia environment as per http://batavia.readthedocs.io/en/latest/tutorial/tutorial-1.html.

On Windows, when I ran (beeware) c:\beeware\batavia\testserver>python manage.py runserver

I got this error: Performing system checks...

Unhandled exception in thread started by <function check_errors..wrapper at 0x00000265D1710AE8> Traceback (most recent call last): File "C:\IntelPython3\envs\beeware\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper fn(*args, kwargs) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run self.check(display_num_errors=True) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\core\management\base.py", line 385, in check include_deployment_checks=include_deployment_checks, File "C:\IntelPython3\envs\beeware\lib\site-packages\django\core\management\base.py", line 372, in _run_checks return checks.run_checks(kwargs) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config return check_resolver(resolver) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "C:\IntelPython3\envs\beeware\lib\site-packages\django\utils\functional.py", line 35, in get res = instance.dict[self.name] = self.func(instance) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\urls\resolvers.py", line 310, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\utils\functional.py", line 35, in get res = instance.dict[self.name] = self.func(instance) File "C:\IntelPython3\envs\beeware\lib\site-packages\django\urls\resolvers.py", line 303, in urlconf_module return import_module(self.urlconf_name) File "C:\IntelPython3\envs\beeware\lib\importlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 985, in _gcd_import File "", line 968, in _find_and_load File "", line 957, in _find_and_load_unlocked File "", line 673, in _load_unlocked File "", line 697, in exec_module File "", line 222, in _call_with_frames_removed File "c:\beeware\batavia\testserver\urls.py", line 8, in from test import pystone ImportError: cannot import name 'pystone'

Any suggestion ?

Your Environment

Windows 10 version 1709 (OS Build 16299.309) Python 3.5.5 | packaged by conda-forge | (default, Feb 13 2018, 06:15:35) [MSC v.1900 64 bit (AMD64)] on win32

freakboy3742 commented 6 years ago

Thanks for the report.

Unfortunately, this is a problem with Conda. The version of Python that they ship has many pieces - like the test library - stripped out. If you have a Python install from other sources (like the official binaries), test.pystone exists.

That said, in Python 3.7, it appears that PyStone has been stripped out anyway, so we may need to package pystone as part of Batavia itself.

parastripathi commented 6 years ago

I was also facing the same issue on Ubuntu 16.04 while running the server. The pystone.py file was available in test folder inside testserver/test/pystone.py but it was not available while running the server as python installation by anaconda affects it. So by adding pystone.py file in anaconda/lib/python3.6/test/ helps in resolving the issue.