Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange top level import issue #24

Open
lingfish opened this issue Apr 27, 2019 · 4 comments
Open

Strange top level import issue #24

lingfish opened this issue Apr 27, 2019 · 4 comments

Comments

@lingfish
Copy link

Python 2.7.13
syncthing 2.3.1

I have no idea why the interpreter is hitting line 41, but it is:

(syncthing) jason@host:~$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from syncthing import Syncthing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jason/venv/syncthing/local/lib/python2.7/site-packages/syncthing/__init__.py", line 41
    raise SyncthingError(msg) from exc
                                 ^
SyntaxError: invalid syntax
>>> from syncthing import Syncthing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name Syncthing

Full import:

(syncthing) jason@host:~$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import syncthing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jason/venv/syncthing/local/lib/python2.7/site-packages/syncthing/__init__.py", line 41
    raise SyncthingError(msg) from exc
                                 ^
SyntaxError: invalid syntax
>>> import syncthing
>>> s = syncthing.Syncthing()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Syncthing'
>>> 
@lingfish
Copy link
Author

Appears to be a Python 2 vs 3 thing. When using a 3 virtualenv, it works fine.

@blakev
Copy link
Owner

blakev commented Apr 30, 2019

@lingfish yeah, Python 3 only. I'd accept pull requests if you want to support Python2 as well.

@blakev blakev closed this as completed Apr 30, 2019
@lingfish
Copy link
Author

Ok, I may have a stab at it.

Would have been useful if your doco clearly stated Python version support, and any code cleared of hints that it did in fact support 2.

@blakev
Copy link
Owner

blakev commented May 1, 2019

@lingfish actually this is a bug, i haven't worked on this library for a long time and it should be version-2 compatible. I will fix it!

@blakev blakev reopened this May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants