chcli icon indicating copy to clipboard operation
chcli copied to clipboard

Python 3 support

Open rubik opened this issue 8 years ago • 8 comments

It would be nice to have Python 3 support. I get this error while running the program:

$ challenges --active                                                                                                                               ⏎
Traceback (most recent call last):
  File /home/u/v/bin/challenges, line 7, in <module>
    from challenges.cli import main
  File /home/u/v/lib/python3.5/site-packages/challenges/cli.py, line 7, in <module>
    from local_exceptions import IncorrectParametersException
ImportError: No module named 'local_exceptions'

rubik avatar Oct 09 '15 21:10 rubik

Installed it in a virtualenv running python3 and could not replicate the error.

luizpericolo avatar Oct 20 '15 14:10 luizpericolo

That's very odd. I can replicate it with both Python 3.4 and 3.5.

rubik avatar Oct 20 '15 16:10 rubik

I may be doing something wrong. Here is what I did: $ mkvirtualenv -ppython3 chcli $ pip3 install challenge-cli $ challenges --active

And after the call to challenges, the challenges are listed with no error. When I run python inside the virtualenv it shows the version 3.4.3 Did I miss something?

luizpericolo avatar Oct 20 '15 17:10 luizpericolo

Could it be that your CWD is the project root? If that were the case local_exceptions.py would be automatically added to the Python path. Here's what I am doing:

~ $ virtualenv -p python3.5 test
Running virtualenv with interpreter /usr/local/bin/python3.5
Using base prefix '/usr/local'
New python executable in test/bin/python3.5
Also creating executable in test/bin/python
Installing setuptools, pip, wheel...done.
~ $ cd test
~/test $ source bin/activate
(test) ~/test $ which pip
~/test/bin/pip
(test) ~/test $ pip --version
pip 7.1.2 from ~/test/lib/python3.5/site-packages (python 3.5)
(test) ~/test $ pip install challenge-cli
Collecting challenge-cli
Collecting click>=5.0 (from challenge-cli)
  Using cached click-5.1-py2.py3-none-any.whl
Collecting requests==2.7.0 (from challenge-cli)
  Using cached requests-2.7.0-py2.py3-none-any.whl
Installing collected packages: click, requests, challenge-cli
Successfully installed challenge-cli-0.0.1.0 click-5.1 requests-2.7.0
(test) ~/test $ challenges --active
Traceback (most recent call last):
  File "~/test/bin/challenges", line 7, in <module>
    from challenges.cli import main
  File "~/test/lib/python3.5/site-packages/challenges/cli.py", line 7, in <module>
    from local_exceptions import IncorrectParametersException
ImportError: No module named 'local_exceptions'

rubik avatar Oct 21 '15 09:10 rubik

Did the exactly same thing as you in a new folder without any python code and it ran smoothly.

The only difference is that I could not create a virtualenv with python3.5, I used the following command:

$ virtualenv -p python3 test

instead of

$ virtualenv -p python3.5 test

Could that produce the difference in execution success?

luizpericolo avatar Oct 21 '15 12:10 luizpericolo

I don't know how Python's version could interfere. I confirmed that by changing the imports the program runs under Python 3 on my system.

rubik avatar Oct 26 '15 22:10 rubik

Installed it using pip on OSX, and I have the same error (with python 3.4.2)

fpietka avatar Nov 02 '15 10:11 fpietka

Installed it using pip on Arch Linux, and I have the same error (with python 3.5.1)

khalilfazal avatar May 05 '16 20:05 khalilfazal