fchauvel / flap

Flattening LaTeX projects
https://fchauvel.github.io/flap
GNU General Public License v3.0
17 stars 2 forks source link

Unable to process due to 'invalid syntax' #11

Open boudiccas opened 8 years ago

boudiccas commented 8 years ago

When trying to run flap on a fully uptodate debian jessie, it consistently fails with this error report -

python -m flap /home/boudiccas/research/herbal/000herbal.tex output
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/flap/__main__.py", line 19, in <module>
    from flap.ui import main
  File "/usr/local/lib/python2.7/dist-packages/flap/ui.py", line 73
    print(message, file=self._output)
                       ^
SyntaxError: invalid syntax

It makes no difference if I try with python3 or sudo python3 or sudo python it just fails with above error report.

fchauvel commented 8 years ago

Hello,

Thanks for giving flap a try. From the top of my head, I don't have a clue about what may cause that. I will look at this week, and let you know as soon as I find a fix.

fchauvel commented 8 years ago

I installed a fresh Debian 8.2 Jessie (Linux 3.16.0-4-amd64) on a virtualbox, but I was not able to reproduce your issue (I installed Python 3.4.2 using Apt). Could you tell what version of FLaP you tried to install and which version of python you are using?

boudiccas commented 8 years ago

Franck Chauvel notifications@github.com writes:

I installed a fresh Debian 8.2 Jessie (Linux 3.16.0-4-amd64) on a virtualbox, but I was not able to reproduce your issue (I installed Python 3.4.2 using Apt). Could you tell what version of FLaP you tried to install and which version of python you are using?

Thanks Franck, my python version is 2.7.9-1 which is the only one available from the debian repos.

--8<---------------cut here---------------start------------->8--- rmadison python python | 2.6.6-3+squeeze7 | oldoldstable | all python | 2.7.3-4+deb7u1 | oldstable | all python | 2.7.9-1 | stable | amd64, arm64, armel, armhf, i386, mips, mipsel, powerpc, ppc64el, s390x python | 2.7.9-1 | stable-kfreebsd | kfreebsd-amd64, kfreebsd-i386 python | 2.7.9-1 | testing | amd64, arm64, armel, armhf, i386, mips, mipsel, powerpc, ppc64el, s390x python | 2.7.9-1 | unstable | amd64, arm64, armel, armhf, hurd-i386, i386, kfreebsd-amd64, kfreebsd-i386, mips, mips64el, mipsel, powerpc, ppc64el, s390x --8<---------------cut here---------------end--------------->8---

flap =

--8<---------------cut here---------------start------------->8--- /usr/local/lib/python2.7/dist-packages/flap /usr/local/lib/python2.7/dist-packages/flap/FileSystem.py /usr/local/lib/python2.7/dist-packages/flap/FileSystem.pyc /usr/local/lib/python2.7/dist-packages/flap/init.py /usr/local/lib/python2.7/dist-packages/flap/init.pyc /usr/local/lib/python2.7/dist-packages/flap/main.py /usr/local/lib/python2.7/dist-packages/flap/main.pyc /usr/local/lib/python2.7/dist-packages/flap/engine.py /usr/local/lib/python2.7/dist-packages/flap/engine.pyc /usr/local/lib/python2.7/dist-packages/flap/path.py /usr/local/lib/python2.7/dist-packages/flap/path.pyc /usr/local/lib/python2.7/dist-packages/flap/ui.py /usr/local/lib/python2.7/dist-packages/flap/util.py /usr/local/lib/python2.7/dist-packages/flap/util.pyc --8<---------------cut here---------------end--------------->8---

Does this help?

Sharon.

A taste of linux = http://www.sharons.org.uk TGmeds = http://www.tgmeds.org.uk Debian 8.0, fluxbox 1.3.7, emacs 24.5.1

fchauvel commented 8 years ago

I managed to reproduce the error you have, when I ran FLaP using Python 2.7.9. As FLaP was written for Python 3 in the first place, I suggest to upgrade as a quick fix. Unfortunately, I will not have time to port FLaP to Python 2 in the following months.

By the way, I currently have both Python 2 and 3 on the same Debian Jessie (I used to switch using virtual environments). I installed Python 3 on Jessie from the official repositories (see https://packages.debian.org/jessie/python3-all).

Just let me know if you still face the same issue using Python 3.

boudiccas commented 8 years ago

Franck Chauvel notifications@github.com writes:

I managed to reproduce the error you have, when I ran FLaP using Python 2.7.9. As FLaP was written for Python 3 in the first place, I suggest to upgrade as a quick fix. Unfortunately, I will not have time to port FLaP to Python 2 in the following months.

By the way, I currently have both Python 2 and 3 on the same Debian Jessie (I used to switch using virtual environments). I installed Python 3 on Jessie from the official repositories (see https://packages.debian.org/jessie/python3-all).

Just let me know if you still face the same issue using Python 3.

Thanks Franck. It turns out that I do have python3 already installed, but just tend to use whatever the default python is, in this case 2.7!

Anyway I tried to use python3 with flap and it said that flap wasn't available, so I did some checking, and this is what I found -

--8<---------------cut here---------------start------------->8--- sudo pip install flap [sudo] password for boudiccas: Requirement already satisfied (use --upgrade to upgrade): flap in /usr/local/lib/python2.7/dist-packages Cleaning up... --8<---------------cut here---------------end--------------->8---

I could maybe uninstall flap -

--8<---------------cut here---------------start------------->8--- sudo pip uninstall flap Uninstalling FLaP: /usr/local/lib/python2.7/dist-packages/FLaP-0.3.0.egg-info /usr/local/lib/python2.7/dist-packages/flap/FileSystem.py /usr/local/lib/python2.7/dist-packages/flap/FileSystem.pyc /usr/local/lib/python2.7/dist-packages/flap/init.py /usr/local/lib/python2.7/dist-packages/flap/init.pyc /usr/local/lib/python2.7/dist-packages/flap/main.py /usr/local/lib/python2.7/dist-packages/flap/main.pyc /usr/local/lib/python2.7/dist-packages/flap/engine.py /usr/local/lib/python2.7/dist-packages/flap/engine.pyc /usr/local/lib/python2.7/dist-packages/flap/path.py /usr/local/lib/python2.7/dist-packages/flap/path.pyc /usr/local/lib/python2.7/dist-packages/flap/ui.py /usr/local/lib/python2.7/dist-packages/flap/util.py /usr/local/lib/python2.7/dist-packages/flap/util.pyc /usr/local/lib/python2.7/dist-packages/tests/init.py /usr/local/lib/python2.7/dist-packages/tests/init.pyc /usr/local/lib/python2.7/dist-packages/tests/acceptance.py /usr/local/lib/python2.7/dist-packages/tests/acceptance.pyc /usr/local/lib/python2.7/dist-packages/tests/commons.py /usr/local/lib/python2.7/dist-packages/tests/commons.pyc /usr/local/lib/python2.7/dist-packages/tests/sandbox.py /usr/local/lib/python2.7/dist-packages/tests/sandbox.pyc /usr/local/lib/python2.7/dist-packages/tests/unit/init.py /usr/local/lib/python2.7/dist-packages/tests/unit/init.pyc /usr/local/lib/python2.7/dist-packages/tests/unit/engine.py /usr/local/lib/python2.7/dist-packages/tests/unit/engine.pyc /usr/local/lib/python2.7/dist-packages/tests/unit/fileSystem.py /usr/local/lib/python2.7/dist-packages/tests/unit/fileSystem.pyc /usr/local/lib/python2.7/dist-packages/tests/unit/path.py /usr/local/lib/python2.7/dist-packages/tests/unit/path.pyc /usr/local/lib/python2.7/dist-packages/tests/unit/ui.py /usr/local/lib/python2.7/dist-packages/tests/unit/ui.pyc /usr/local/lib/python2.7/dist-packages/tests/unit/util.py /usr/local/lib/python2.7/dist-packages/tests/unit/util.pyc Proceed (y/n)? n --8<---------------cut here---------------end--------------->8---

but then, how do I install it just for python3? If I manually remove it From python2.7 and place it in python3, surely that would break something?

Any ideas please?

Thanks

Sharon.

A taste of linux = http://www.sharons.org.uk TGmeds = http://www.tgmeds.org.uk Debian 8.0, fluxbox 1.3.7, emacs 24.5.1

fchauvel commented 8 years ago

I'm using virtualenv. It creates local installations of python, where one can install packages without installing them for all other projects or users. From memory, the sequence of commands to use is something like:

$> pip install virtualenv
$> cd my/project/folder
$> virtualenv --python=python3 env3
$> source env3/bin/activate
$> pip install flap

The third command creates the env3directory, which contains an installation (probably some links) to Python 3 (which must be already available on your system). The fourth command activates this brand new Python environment, and finally we install flap only in this environment. I personally find virtualenv pretty handy when working simultaneously on projects that require different or incompatible settings.

Hope this helps.