Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError
#1
Hi,

I am Mark and i have just registered to this forum and installed Python 3.8.
Im not experienced yet with Python so i like to ask for a possible solution to my questions.

I have a Campbell Scientific CR1000 datalogger which id like to connect to and get data from with Python.
I found a python package called pycampbellcr1000 which ive installed.
Unfortunately i get a AttributeError when i try to connect with the cr1000.
The actual error code is:
Error:
Traceback (most recent call last): File "C:\Program Files\Python\Lib\site-packages\pycampbellcr1000\compat.py", line 94, in <module> stdout = sys.stdout.buffer AttributeError: 'StdOutputFile' object has no attribute 'buffer' >>>
The compat.py file is:
# coding: utf8
'''
    PyCampbellCR1000.compat
    -----------------------

    Workarounds for compatibility with Python 2 and 3 in the same code base.

    :copyright: Copyright 2012 Salem Harrache and contributors, see AUTHORS.
    :license: GNU GPL v3.

'''
import sys

# -------
# Pythons
# -------

# Syntax sugar.
_ver = sys.version_info

#: Python 2.x?
is_py2 = (_ver[0] == 2)

#: Python 3.x?
is_py3 = (_ver[0] == 3)

#: Python 3.0.x
is_py30 = (is_py3 and _ver[1] == 0)

#: Python 3.1.x
is_py31 = (is_py3 and _ver[1] == 1)

#: Python 3.2.x
is_py32 = (is_py3 and _ver[1] == 2)

#: Python 3.3.x
is_py33 = (is_py3 and _ver[1] == 3)

#: Python 3.4.x
is_py34 = (is_py3 and _ver[1] == 4)

#: Python 2.7.x
is_py27 = (is_py2 and _ver[1] == 7)

#: Python 2.6.x
is_py26 = (is_py2 and _ver[1] == 6)

# ---------
# Specifics
# ---------

if is_py2:
    if is_py26:
        from logging import Handler

        class NullHandler(Handler):
            def emit(self, record):
                pass
        from ordereddict import OrderedDict
    else:
        from logging import NullHandler
        from collections import OrderedDict
    from StringIO import StringIO

    ord = ord
    chr = chr

    def to_char(string):
        if len(string) == 0:
            return bytes('')
        return bytes(string[0])

    bytes = str
    str = unicode
    stdout = sys.stdout
    xrange = xrange


elif is_py3:
    from collections import OrderedDict
    from logging import NullHandler
    from io import StringIO

    ord = lambda x: x
    chr = lambda x: bytes([x])

    def to_char(string):
        if len(string) == 0:
            return str('')
        return str(string[0])

    str = str
    bytes = bytes
    stdout = sys.stdout.buffer
    xrange = range


def is_text(data):
    '''Check if data is text instance'''
    return isinstance(data, str)


def is_bytes(data):
    '''Check if data is bytes instance'''
    return isinstance(data, bytes)
Maybe someone over here can provide me a solution for this?

Thanks.

With kind regards,

Mark
Reply


Messages In This Thread
AttributeError - by Makada - Nov-17-2019, 03:18 PM
RE: AttributeError - by Larz60+ - Nov-17-2019, 04:12 PM
RE: AttributeError - by Makada - Nov-17-2019, 04:32 PM
RE: AttributeError - by Makada - Nov-17-2019, 07:51 PM
RE: AttributeError - by Larz60+ - Nov-17-2019, 11:16 PM
RE: AttributeError - by Makada - Nov-18-2019, 07:07 AM
RE: AttributeError - by baquerik - Nov-18-2019, 03:12 PM
RE: AttributeError - by Makada - Nov-18-2019, 06:29 PM
RE: AttributeError - by ThomasL - Nov-18-2019, 06:37 PM
RE: AttributeError - by Makada - Nov-18-2019, 07:19 PM
RE: AttributeError - by ThomasL - Nov-18-2019, 07:40 PM
RE: AttributeError - by Makada - Nov-18-2019, 08:37 PM
RE: AttributeError - by ThomasL - Nov-18-2019, 08:49 PM
RE: AttributeError - by Makada - Nov-19-2019, 06:15 PM
RE: AttributeError - by baquerik - Nov-19-2019, 06:27 PM
RE: AttributeError - by Makada - Nov-19-2019, 08:46 PM
RE: AttributeError - by Makada - Nov-23-2019, 10:36 AM
RE: AttributeError - by Makada - Apr-26-2020, 03:11 PM
RE: AttributeError - by buran - Apr-26-2020, 03:19 PM
RE: AttributeError - by Makada - Apr-26-2020, 03:28 PM
RE: AttributeError - by Makada - Apr-27-2020, 12:08 PM
RE: AttributeError - by Makada - Nov-07-2020, 07:49 PM
RE: AttributeError - by Makada - Nov-11-2020, 06:04 PM
RE: AttributeError - by bowlofred - Nov-11-2020, 06:43 PM
RE: AttributeError - by Makada - Feb-05-2022, 07:22 PM
RE: AttributeError - by deanhystad - Feb-05-2022, 11:00 PM
RE: AttributeError - by Makada - Feb-06-2022, 05:14 AM
RE: AttributeError - by deanhystad - Feb-06-2022, 11:40 PM
RE: AttributeError - by Makada - Feb-07-2022, 05:25 AM
RE: AttributeError - by Makada - Feb-07-2022, 12:57 PM
RE: AttributeError - by deanhystad - Feb-07-2022, 02:46 PM
RE: AttributeError - by Makada - Feb-07-2022, 02:51 PM
RE: AttributeError - by Makada - Feb-10-2022, 09:27 AM
RE: AttributeError - by deanhystad - Feb-10-2022, 07:43 PM
RE: AttributeError - by Makada - Feb-19-2023, 07:50 PM
RE: AttributeError - by deanhystad - Feb-19-2023, 08:47 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020