slashmili / django-jalali

Jalali DateField support for Django model
http://pypi.python.org/pypi/django_jalali
BSD 3-Clause "New" or "Revised" License
254 stars 53 forks source link

python 3.4 support #13

Closed pajooh closed 8 years ago

pajooh commented 9 years ago

trying to pip install https://github.com/slashmili/django-jalali/archive/master.zip, i get:

...
Installing collected packages: django-jalali
  Running setup.py install for django-jalali

      File "/home/user/.venvs/py3/lib/python3.4/site-packages/django_jalali/db/models.py", line 80
        except ValueError, e:
                         ^
    SyntaxError: invalid syntax

      File "/home/user/.venvs/py3/lib/python3.4/site-packages/django_jalali/tests/__init__.py", line 64
        jdt_model.date_time = datetime.datetime(1390,01,02)
                                                      ^
    SyntaxError: invalid token

Successfully installed django-jalali
Cleaning up...
slashmili commented 9 years ago

It should be fixed. try again

pajooh commented 9 years ago

Nope, the error is here yet anyway, thank you for your fast consideration!!!

slashmili commented 9 years ago

try this:

pip install https://github.com/slashmili/django-jalali/archive/python-3.4-support.zip

pajooh commented 9 years ago

i used pip install -e git://github.com/slashmili/django-jalali.git@master#egg=django_jalali to get the latest master push, the installation completed, but trying to activate it in my `INSTALLED_APP, i get:

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/user/.venvs/py3/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/user/.venvs/py3/lib/python3.4/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/home/user/.venvs/py3/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/user/.venvs/py3/lib/python3.4/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/home/user/.venvs/py3/lib/python3.4/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/home/user/.venvs/py3/lib/python3.4/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/user/.venvs/py3/lib/python3.4/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/home/user/.venvs/py3/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/user/.venvs/py3/src/django-jalali/django_jalali/admin/__init__.py", line 1, in <module>
    from django_jalali.db.models import jDateField, jDateTimeField
  File "/home/user/.venvs/py3/src/django-jalali/django_jalali/db/models.py", line 80
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

as you can see, the except ValueError, e syntax is not valid in python 3 at all how about simply running 2to3 tool to change all this kind of incompatible code?

slashmili commented 9 years ago

Please install it from python-3.4-support branch and let me know if it works, then I'll merge it to master

pip install https://github.com/slashmili/django-jalali/archive/python-3.4-support.zip
slashmili commented 8 years ago

It's done, you can get the new version (2.0) and it would work in python 3.4.

We also have test for this project which runs on multiple python/django versions

https://travis-ci.org/slashmili/django-jalali