Skip to content

[WIP] Victor Mikhan #55

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

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

viktarmikhan
Copy link

No description provided.

@AlexeiBuzuma AlexeiBuzuma added the MissedPRDeadline Pull request has been opened after hard deadline. label Nov 17, 2019
@viktarmikhan viktarmikhan changed the title [WIP] VICTOR MIKHAN [WIP] Victor Mikhan Nov 17, 2019
@AlexeiBuzuma AlexeiBuzuma added the [Deadline] Iteration 1-2 This is a marker for first and second iterations deadline. label Nov 17, 2019
import setuptools
import conf

setuptools.setup(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не получается установить пакет

# pip install .
Processing /PythonHomework
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-v64yw744/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-v64yw744/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-v64yw744/pip-egg-info
         cwd: /tmp/pip-req-build-v64yw744/
    Complete output (8 lines):
    running egg_info
    creating /tmp/pip-req-build-v64yw744/pip-egg-info/rss_reader.egg-info
    writing /tmp/pip-req-build-v64yw744/pip-egg-info/rss_reader.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-req-build-v64yw744/pip-egg-info/rss_reader.egg-info/dependency_links.txt
    writing entry points to /tmp/pip-req-build-v64yw744/pip-egg-info/rss_reader.egg-info/entry_points.txt
    writing top-level names to /tmp/pip-req-build-v64yw744/pip-egg-info/rss_reader.egg-info/top_level.txt
    writing manifest file '/tmp/pip-req-build-v64yw744/pip-egg-info/rss_reader.egg-info/SOURCES.txt'
    error: package directory 'rss_reader' does not exist
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

@AlexeiBuzuma
Copy link
Collaborator

К сожалению, у меня не получилось запустить :(
не могу проверить работоспособность решения

# rss-reader --help
Traceback (most recent call last):
  File "/usr/local/bin/rss-reader", line 5, in <module>
    from __main__ import main
ImportError: cannot import name 'main' from '__main__' (/usr/local/bin/rss-reader)

@AlexeiBuzuma
Copy link
Collaborator

Есть проблема с зависимостями

# rss-reader --help
Traceback (most recent call last):
  File "/usr/local/bin/rss-reader", line 5, in <module>
    from src.rss_reader import main
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 5, in <module>
    from .components.feed import *
  File "/usr/local/lib/python3.8/site-packages/src/components/feed/__init__.py", line 1, in <module>
    from .feed import Feed
  File "/usr/local/lib/python3.8/site-packages/src/components/feed/feed.py", line 9, in <module>
    from src.components.logger.logger import Logger
  File "/usr/local/lib/python3.8/site-packages/src/components/logger/__init__.py", line 1, in <module>
    from .logger import Logger
  File "/usr/local/lib/python3.8/site-packages/src/components/logger/logger.py", line 5, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

@AlexeiBuzuma
Copy link
Collaborator

# rss-reader https://news.tut.by/rss/index.rss
Traceback (most recent call last):
  File "/usr/local/bin/rss-reader", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 48, in main
    App.start()
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 40, in start
    return cls()._feed.show_feeds()
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 30, in __init__
    self._feed = Feed(self._console_args)
  File "/usr/local/lib/python3.8/site-packages/src/components/feed/feed.py", line 60, in __init__
    self._parse_feeds()
  File "/usr/local/lib/python3.8/site-packages/src/components/feed/feed.py", line 119, in _parse_feeds
    self._append_feed_entry(item)
  File "/usr/local/lib/python3.8/site-packages/src/components/feed/feed.py", line 148, in _append_feed_entry
    self._entities_list.append(FeedEntry(entry))
  File "/usr/local/lib/python3.8/site-packages/src/components/feed/feed_entry.py", line 27, in __init__
    self.description = self._process_description(entry.summary)
  File "/usr/local/lib/python3.8/site-packages/src/components/feed/feed_entry.py", line 59, in _process_description
    self._soup(description, 'lxml').get_text()
  File "/usr/local/lib/python3.8/site-packages/bs4/__init__.py", line 213, in __init__
    raise FeatureNotFound(
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

@AlexeiBuzuma
Copy link
Collaborator

конвертация в PDF

# rss-reader https://news.tut.by/rss/index.rss --to-pdf /data/my_news.pdf


Traceback (most recent call last):
  File "/usr/local/bin/rss-reader", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 48, in main
    App.start()
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 40, in start
    return cls()._feed.show_feeds()
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 36, in __init__
    PdfConverter(self._console_args.to_pdf, self._console_args.limit).render(self._feed)
  File "/usr/local/lib/python3.8/site-packages/src/components/converter/html/html_converter.py", line 41, in render
    self._entry_render(entry)
  File "/usr/local/lib/python3.8/site-packages/src/components/converter/html/html_converter.py", line 87, in _entry_render
    return self._template_processor.get_template('entry.html.jinja2').render(
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 830, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "/usr/local/lib/python3.8/site-packages/jinja2/loaders.py", line 113, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "/usr/local/lib/python3.8/site-packages/jinja2/loaders.py", line 187, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: entry.html.jinja2

@AlexeiBuzuma
Copy link
Collaborator

К сожалению, такая же ситуация с HTML

@AlexeiBuzuma
Copy link
Collaborator

Кэш при отключенном интернете не работает

# rss-reader https://news.tut.by/rss/index.rss --date 20191208
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/urllib/request.py", line 1317, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/local/lib/python3.8/http/client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.8/http/client.py", line 1276, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.8/http/client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.8/http/client.py", line 1004, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.8/http/client.py", line 944, in send
    self.connect()
  File "/usr/local/lib/python3.8/http/client.py", line 1392, in connect
    super().connect()
  File "/usr/local/lib/python3.8/http/client.py", line 915, in connect
    self.sock = self._create_connection(
  File "/usr/local/lib/python3.8/socket.py", line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/local/lib/python3.8/socket.py", line 914, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/src/components/parser/arguments/positional/source.py", line 30, in _validate_source
    if url.urlopen(source).getcode() is not 200:
  File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 1360, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/local/lib/python3.8/urllib/request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/rss-reader", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 48, in main
    App.start()
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 40, in start
    return cls()._feed.show_feeds()
  File "/usr/local/lib/python3.8/site-packages/src/rss_reader.py", line 25, in __init__
    self._console_args = console.get_args()
  File "/usr/local/lib/python3.8/site-packages/src/components/parser/parser.py", line 41, in get_args
    return self._parser.parse_args()
  File "/usr/local/lib/python3.8/argparse.py", line 1768, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/local/lib/python3.8/argparse.py", line 1800, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/local/lib/python3.8/argparse.py", line 1988, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
  File "/usr/local/lib/python3.8/argparse.py", line 1965, in consume_positionals
    take_action(action, args)
  File "/usr/local/lib/python3.8/argparse.py", line 1858, in take_action
    argument_values = self._get_values(action, argument_strings)
  File "/usr/local/lib/python3.8/argparse.py", line 2388, in _get_values
    value = self._get_value(action, arg_string)
  File "/usr/local/lib/python3.8/argparse.py", line 2421, in _get_value
    result = type_func(arg_string)
  File "/usr/local/lib/python3.8/site-packages/src/components/parser/arguments/positional/source.py", line 39, in _validate_source
    raise url.URLError(f'Something wrong with your source. Please try another rss feed: {e}')
urllib.error.URLError: <urlopen error Something wrong with your source. Please try another rss feed: <urlopen error [Errno -3] Temporary failure in name resolution>>

victormikhan added 2 commits December 8, 2019 19:42
…installing module. add package_data in setup.py to preserve non-py files in module
@viktarmikhan
Copy link
Author

viktarmikhan commented Dec 9, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants