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

Fabric #4

Closed
VirTechSystems opened this issue Jun 14, 2018 · 2 comments
Closed

Fabric #4

VirTechSystems opened this issue Jun 14, 2018 · 2 comments

Comments

@VirTechSystems
Copy link

Which version of fabric does this require? I've have the latest 1.x branch installed:

Name: Fabric
Version: 1.13.1

Getting an exception when trying to use this api.

File "/srv/tsheets/lib/python3.6/site-packages/fabric/context_managers.py", line 535
def accept(channel, (src_addr, src_port), (dest_addr, dest_port)):
^
SyntaxError: invalid syntax

@daveschaefer
Copy link
Contributor

I believe this is actually an issue with the syntax used for importing. The code just needs to be updated to use a local import.

If I try to import and use this tsheets module, I get an error like:

from tsheets.api import TSheets

File "site-packages/tsheets/init.py", line 1, in
import repos
File "site-packages/repos.py", line 9, in
from fabric.api import local, lcd as cd, task
ModuleNotFoundError: No module named 'fabric.api'

I believe this is because tsheets/init.py should be using a different import syntax.
Instead of
"import repos"
It should be doing:
"from . import repos"

  • i.e. it should import the local module "tsheets.repos". NOT the separate python package 'repos'.[1]

Without the local import specification, python was attempting to import the separate python package 'repos'[1].
If you happened to already have the 'repos' package installed on your system, depending on the version, the python code inside 'repos' started with this code:
"from fabric.api import ..."

This import call inside 'repos' would then attempt to import the 'fabric' package.

Neither 'fabric' nor 'repos' seem to be needed to run this tsheets python module.
It just needs to use a local, relative import, to use its own code.

My patch in #6 should fix this.

[1] https://pypi.org/project/repos/

@dustinsweet
Copy link
Contributor

The fix is merged to master. Thanks once again Dave!

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

3 participants