savetxt() errors with python3
See original GitHub issueHere’s the error message. Should be easy to fix.
In [10]: sol.savetxt()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-fff6eb73d01a> in <module>
----> 1 sol.savetxt()
c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\solution_array.py in savetxt(self, filename, printmodel, **kwargs)
508 with open(filename, "w") as f:
509 if printmodel and self.model:
--> 510 f.write(str(self.model).encode("utf-8"))
511 f.write(self.table(**kwargs).encode("utf-8"))
512
TypeError: write() argument must be str, not bytes
Since GPkit claims to be python2/3 compatible, we should perhaps consider running tests for both versions to avoid future issues.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
numpy.savetxt resulting a formatting mismatch error in ...
When I'm stepping into the savetxt code, the print the error (traceback.format_exc()) in the catch block (numpy.lib.npyio, line 1158), the error is ...
Read more >numpy.savetxt cannot save file correctly using file handle
I can save the array to a "foo.txt" file as below: np.savetxt('foo.txt', points, fmt='%f %f %f %d %d %d') but if I run...
Read more >numpy.savetxt — NumPy v1.24 Manual
Save an array to a text file. Parameters: fnamefilename or file handle. If the filename ends in .gz , the file ...
Read more >Python NumPy Savetxt + Examples
To save a numpy array to a text file we can easily use the numpy.savetxt() method. In Python, this method is available in...
Read more >How to load and save 3D Numpy array to file using savetxt ...
Numpy.savetxt() is a method in python in numpy library to save an 1D and 2D array to a file. Syntax: numpy.savetxt ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
(weekly ping)
Let’s try and debug this on your computer early next week.