Skip to content
Advertisement

Tag: python-3.x

How to solve UnicodeDecodeError in Python 3.6?

I am switched from Python 2.7 to Python 3.6. I have scripts that deal with some non-English content. I usually run scripts via Cron and also in Terminal. I had UnicodeDecodeError in my Python 2.7 scripts and I solved by this. Now in Python 3.6, it doesnt work. I have print statements like print(“Here %s” % (myvar)) and it throws

ModuleNotFoundError when running script from Terminal

I have the following folder structure: app __init__.py utils __init__.py transform.py products __init__.py fish.py In fish.py I’m importing transform as following: import utils.transform. When I’m running fish.py from Pycharm, it works perfectly fine. However when I am running fish.py from the Terminal, I am getting error ModuleNotFoundError: No module named ‘utils’. Command I use in Terminal: from app folder python

AttributeError when reading a pickle file

I get the following error when I’m reading my .pkl files on spyder (python 3.6.5): The context: My program is made of one file: program.py In the program, a class Signal is defined as well as many functions. A simplified overview of the program is provided below: The function compute_data will return a list of tuples of the form: With,

Convert date object in normal format

When I am using a Python object, I get: This is not the format I need. We need to convert to this data format: How can I convert this in Python/Django? Example: It’s working fine, but how can I pass 2018-05-18 10:05:06 as database but database giving? It’s giving 2018-05-18 08:38:58+00:00. How can I check date as per 2018-05-18 08:38:58?

Advertisement