cvarelaruiz / owi2plex

Exporter of EPG from OpenWebif to XMLTV to use with Plex
Mozilla Public License 2.0
26 stars 6 forks source link

AttributeError: type object 'datetime.datetime' has no attribute 'timestamp' #15

Closed tomek0o7 closed 4 years ago

tomek0o7 commented 4 years ago

I have such a problem as described in the subject. I installed pip first, later with OWi2Plex pip. When I want to execute a script with this add-on I get a message:

owi2plex -b "The name of the bouquet" -h "192.168.X.X" -u "user" -p "pass" -o "/volume1/Cloud/epg.xml"

Traceback (most recent call last): File "/bin/owi2plex", line 10, in <module> sys.exit(main()) File "/usr/lib/python2.7/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python2.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python2.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/usr/bin/owi2plex.py", line 369, in main tzoffset = getOffset(api_root_url=api_root_url) File "/usr/bin/owi2plex.py", line 128, in getOffset now = datetime.timestamp(datetime.now()) AttributeError: type object 'datetime.datetime' has no attribute 'timestamp'

Apparently the problem is solved by python version 3.6. I tried to install but something is not working. I have the impression that after uninstalling python 2.7, it still uses it.

wilb commented 4 years ago

What system are you using? I had the same problem on Ubuntu 18.04 - just need to ensure you have pip3 installed rather than pip2 and use that to install owi2plex:

apt install python3-pip pip3 install owi2plex

cvarelaruiz commented 4 years ago

@tomek0o7 try what @wilb is suggesting. Try running:

pip -V
python -V

To see what is the default in your system. There's ways of changing the default too but it can cause all sort of trouble.

Alternatively you can create a Virtual Environment with venv and install owi2plex in there, just remember to explicitly use the python executable of the venv. For instance, say you have a virtual environemnt in ~/venvs/owi2plex, you can then run it like this:

~/venvs/owi2plex/scripts/python ~/path-to-owi2plex/owi2plex.py

cvarelaruiz commented 4 years ago

Closing this issue as OWI2Plex won't work with Python2 without major changes.

Only Python3, sorry.