1

Ok so I have the following code:

def rate_of_work(self):
    global rate
    rate = (turtle.textinput("Your Work Rate","What is your hourly work rate in US Dollars?"))
    outFile_rate = pickle.dumps(rate)

rate1 = pickle.loads(rate)
rate2 = ((hours*rate1) + (minutes*rate1)*0.0167 + (seconds*rate1)*0.000278) #isnt necessary information
rate3 = round(rate2, 2) #isnt necessary information

im getting the error:

rate1 = pickle.loads(rate)
TypeError: 'str' does not support the buffer interface

please help

3
  • Your code never sets rate. Commented Dec 30, 2013 at 2:57
  • What is the point of outFile_rate? Commented Dec 30, 2013 at 2:58
  • 1
    This error can't be reproduced with code provided, as pickled value is never saved or returned. Commented Dec 30, 2013 at 2:59

1 Answer 1

3

I assume you are working under python 3.x

For the specific error, pickle.loads() only accepts bytes, and you are trying to give a plain string to it, that's why it fails.

>>> pickle.loads("")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' does not support the buffer interface
>>> pickle.loads(b"")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
EOFError
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.