Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Commit 
							
							·
						
						ec0919d
	
1
								Parent(s):
							
							b971eee
								
Fix unicode printing issue on Windows
Browse files- pysr/sr.py +7 -8
 
    	
        pysr/sr.py
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 1 | 
         
             
            import os
         
     | 
| 
         | 
|
| 2 | 
         
             
            from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
         
     | 
| 3 | 
         
             
            from collections import namedtuple
         
     | 
| 4 | 
         
             
            import pathlib
         
     | 
| 
         @@ -385,14 +386,12 @@ def _cmd_runner(command, **kwargs): 
     | 
|
| 385 | 
         
             
                    while True:
         
     | 
| 386 | 
         
             
                        line = process.stdout.readline()
         
     | 
| 387 | 
         
             
                        if not line: break
         
     | 
| 388 | 
         
            -
                         
     | 
| 389 | 
         
            -
             
     | 
| 390 | 
         
            -
             
     | 
| 391 | 
         
            -
             
     | 
| 392 | 
         
            -
             
     | 
| 393 | 
         
            -
             
     | 
| 394 | 
         
            -
                        else:
         
     | 
| 395 | 
         
            -
                            decoded_line = line.decode('utf-8')
         
     | 
| 396 | 
         | 
| 397 | 
         
             
                        print(decoded_line, end='')
         
     | 
| 398 | 
         | 
| 
         | 
|
| 1 | 
         
             
            import os
         
     | 
| 2 | 
         
            +
            import sys
         
     | 
| 3 | 
         
             
            from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
         
     | 
| 4 | 
         
             
            from collections import namedtuple
         
     | 
| 5 | 
         
             
            import pathlib
         
     | 
| 
         | 
|
| 386 | 
         
             
                    while True:
         
     | 
| 387 | 
         
             
                        line = process.stdout.readline()
         
     | 
| 388 | 
         
             
                        if not line: break
         
     | 
| 389 | 
         
            +
                        decoded_line = (line.decode('utf-8')
         
     | 
| 390 | 
         
            +
                                            .replace('\\033[K',  '\033[K')
         
     | 
| 391 | 
         
            +
                                            .replace('\\033[1A', '\033[1A')
         
     | 
| 392 | 
         
            +
                                            .replace('\\033[1B', '\033[1B')
         
     | 
| 393 | 
         
            +
                                            .replace('\\r',      '\r')
         
     | 
| 394 | 
         
            +
                                            .encode(sys.stdout.encoding))
         
     | 
| 
         | 
|
| 
         | 
|
| 395 | 
         | 
| 396 | 
         
             
                        print(decoded_line, end='')
         
     | 
| 397 | 
         |