There is a query to the database.

def get_valid_pumps_query(): session = Session() pumps = session.query(Pump).filter( Pump.max_stage_count > 0 ) return pumps 

there is a function to select the top list

 def get_pumps_toplist(target, casing, selection_opts: SelectionOpts): valid_pumps = get_valid_pumps_query() # подгружаем и фильтруем насосы так, чтобы влезли в трубу с заданным зазором ... pumps_with_criteria.sort(key=lambda pwc: pwc[:3]) # возвращаем насосы, упорядоченные по метрике return [pump_with_criteria[-1] for pump_with_criteria in pumps_with_criteria] 

I have a problem with the data output

 eps_list = app.get_pumps_toplist(attrs, well_state) for eps in eps_list: print(eps.motor.model) 

The result is:

70-STD KM-200-86
??? 20-117? 5

Question marks appear instead of Cyrillic.
Who knows why? How to solve a problem?

It is very strange that a friend of this problem is not observed. Those. he switched to git using git, he ran the code on my branch, and everything is fine with him.

  • is output to the pycharm console. - Jacob Burtsev
  • when using print(repr(s)) it still displays with a question mark '????6?-117/?1' print(ascii(s)) did not help either. - Jacob Burtsev
  • and why, then, does the acquaintance give this code to Cyrillic too? I only have a problem - Jacob Burtsev
  • did the editing of the question - Jacob Burtsev

2 answers 2

 bdOut.encode('utf-8', 'ignore') 
  • What is bdOut? - Jacob Burtsev
  • This is s - the string that is unloaded from the database. - vadim vaduxa
  • did not help. displays anyway with the question mark b '???? 6? -117 /? 1' - Jacob Burtsev

problem solved !!! Before starting the application, you must do the following:

 os.environ["NLS_LANG"] = "AMERICAN.AL32UTF8"