I'm trying to simply draw a picture using stddraw with this code:
def main():
if len(sys.argv) <= 1:
stdio.writeln("ERROR: Too few Arguments")
else:
pic = sys.argv[1]
stddraw.picture(pic)
stddraw.show()
if __name__ == "__main__": main()
but each time I run it with input like "picture.jpg" I get this error:
AttributeError: 'str' object has no attribute 'width'
Why is it processing it as a string and what do I need to do to make it work?
from introcs import Picture, stddraw
def main():
if len(sys.argv) <= 1:
stdio.writeln("ERROR: Too few Arguments")
else:
pic_file = sys.argv[1]
pic = Picture(pic_file) # Create a Picture object
stddraw.picture(pic)
stddraw.show()
if __name__ == "__main__":
main()