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

The 'Try It' code on singer.io doesn't work #66

Open
gamebusterz opened this issue Jun 10, 2020 · 3 comments
Open

The 'Try It' code on singer.io doesn't work #66

gamebusterz opened this issue Jun 10, 2020 · 3 comments

Comments

@gamebusterz
Copy link

gamebusterz commented Jun 10, 2020

The try it https://www.singer.io/#what-it-is code on singer.io doesn't work

After installing
pip3 install target-csv tap-exchangeratesapi

Executing
tap-exchangeratesapi | target-csv

Throws the below error:

Traceback (most recent call last):
  File "/usr/local/bin/tap-exchangeratesapi", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/tap_exchangeratesapi/__init__.py", line 113, in main
    start_date = singer.utils.strptime_with_tz(start_date).date().strftime(DATE_FORMAT)
AttributeError: module 'singer.utils' has no attribute 'strptime_with_tz'

MacOS Mojave (10.14.6)

@TjrGithub
Copy link

It doesn't work on Ubuntu Linux 19.10 either, but for different reasons:
python3.7 -m venv venv-target-csv
. venv-target-csv/bin/activate
pip install target-csv tap-exchangeratesapi
tap-exchangeratesapi | target-csv

Traceback (most recent call last):
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 583, in _build_master
ws.require(requires)
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (singer-python 2.1.4 (/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages), Requirement.parse('singer-python==5.3.3'), {'tap-exchangeratesapi'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/bin/tap-exchangeratesapi", line 6, in
from pkg_resources import load_entry_point
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 3191, in
@_call_aside
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 3175, in _call_aside
f(*args, **kwargs)
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 3204, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 585, in _build_master
return cls._build_from_requirements(requires)
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/home/tjb/Dokumente/cologne_2018/Karriere/optiker-datenanalyse/tmp/singer/venv-target-csv/lib/python3.7/site-packages/pkg_resources/init.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'singer-python==5.3.3' distribution was not found and is required by tap-exchangeratesapi

@TjrGithub
Copy link

It doesn't work in Docker's python container, either, but at least it installs:

docker container run -it python /bin/bash
deactivate; rm -rf venv-target-csv/ ; python3.8 -m venv venv-target-csv/ ; . venv-target-csv/bin/activate ; pip install --upgrade pip ; pip install wheel; pip install target-csv
deactivate; rm -rf venv-tap-exchangeratesapi/ ; python3.8 -m venv venv-tap-exchangeratesapi/ ; . venv-tap-exchangeratesapi/bin/activate ; pip install --upgrade pip ; pip install wheel; pip install tap-exchangeratesapi ; tap-exchangeratesapi >/dev/null

#result: headers but no numbers
venv-tap-exchangeratesapi/bin/tap-exchangeratesapi | venv-target-csv/bin/python venv-target-csv/bin/target-csv
#result: silent failure, no file exchange_rates.csv

@deanmorin
Copy link

Installing the tap and targets in separate virtual environments fixes this issue, but then you get:

Traceback (most recent call last):
  File "/Users/dean/.virtualenvs/tap-exchangeratesapi/bin/tap-exchangeratesapi", line 8, in <module>
    sys.exit(main())
  File "/Users/dean/.virtualenvs/tap-exchangeratesapi/lib/python3.8/site-packages/tap_exchangeratesapi/__init__.py", line 116, in main
    do_sync(config.get('base', 'USD'), start_date)
  File "/Users/dean/.virtualenvs/tap-exchangeratesapi/lib/python3.8/site-packages/tap_exchangeratesapi/__init__.py", line 65, in do_sync
    for rate in payload['rates']:
KeyError: 'rates'

When I inspect payload I see:

{'success': False, 'error': {'code': 101, 'type': 'missing_access_key', 'info': 'You have not supplied an API Access Key. [Required format: access_key=YOUR_ACCESS_KEY]'}}

Given that this "try it" code is many people's first exposure to singer, it really seems like it should be switched to a different tap.

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