Closed 1ozturkbe closed 4 years ago
Removing the encode fixes the problem. Sol'n in the savetxtfix branch.
unfortunately that fix doesn't work for all cases, I'll add the tests to show this :-/
On Thu, Aug 15, 2019, 17:53 Berk Ozturk notifications@github.com wrote:
Removing the encode fixes the problem. Sol'n in the savetxtfix branch.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/convexengineering/gpkit/issues/1415?email_source=notifications&email_token=AALKAGBATGNVEELSJPXWRNTQEXF53A5CNFSM4IMCFHC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4NDI7A#issuecomment-521811068, or mute the thread https://github.com/notifications/unsubscribe-auth/AALKAGHA3WT5R5H5U4FS53TQEXF53ANCNFSM4IMCFHCQ .
Alright, you know best!
unfortunately that fix doesn't work for all cases, I'll add the tests to show this :-/
woot woot re adding tests!
Hmm, I can't reproduce this error; what model were you trying to save?
I have to clean up a lot of code before I can tell you where this occurred... I'm working on about 4 different branches of 4 different repos. I will get back soon.
(weekly ping)
I can no longer replicate this, and don't have time to dig into it... I will reopen if it shows up.
I managed to reproduce this. Look at commit 43ac0c of turbofan, diffix branch. If you run engine_validation in py3, you get the following:
Solving took 14 GP solves and 2.16 seconds.
Checking for relaxed constants...
---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last)
~\Dropbox (MIT)\MIT Graduate School\Code\turbofan\turbofan\engine_validation.py in <module>
794 sol = m.localsolve(verbosity=2, x0=x0)
795 post_process(sol)
--> 796 sol.savetxt()
797
798 #print out various percent differences in TSFC and engine areas
c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\solution_array.py in savetxt(self, filename, printmodel, **kwargs)
510 with open(filename, "w") as f:
511 if printmodel and self.model:
--> 512 f.write(str(self.model))
513 f.write(self.table(**kwargs))
514
c:\users\berk\appdata\local\programs\python\python37\lib\encodings\cp1252.py in encode(self, input, final)
17 class IncrementalEncoder(codecs.IncrementalEncoder):
18 def encode(self, input, final=False):
---> 19 return codecs.charmap_encode(input,self.errors,encoding_table)[0]
20
21 class IncrementalDecoder(codecs.IncrementalDecoder):
UnicodeEncodeError: 'charmap' codec can't encode character '\u03c0' in position 7048: character maps to <undefined>
Not the same as the original error, but I had seen something similar somewhere else.
(note to self, it's actually commit https://github.com/convexengineering/turbofan/pull/22/commits/443ac0c6b0fb50628a7c9035638f368c85bf9ccf)
Alack it runs fine on my computer.
Let's try and debug this on your computer early next week.
Here's the error message. Should be easy to fix.
Since GPkit claims to be python2/3 compatible, we should perhaps consider running tests for both versions to avoid future issues.