mirror of
				https://github.com/python-escpos/python-escpos
				synced 2025-10-23 09:30:00 +00:00 
			
		
		
		
	Fix config loading
This commit is contained in:
		
				
					committed by
					
						
						Davis Goglin
					
				
			
			
				
	
			
			
			
						parent
						
							d5e3d85c4b
						
					
				
				
					commit
					cdf8f6be09
				
			@@ -43,12 +43,16 @@ class Config(object):
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            config = yaml.safe_load(f)
 | 
					            if isinstance(config_path, file):
 | 
				
			||||||
 | 
					                config = yaml.safe_load(config_path)
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                with open(config_path, 'rb') as f:
 | 
				
			||||||
 | 
					                    config = yaml.safe_load(f)
 | 
				
			||||||
        except EnvironmentError as e:
 | 
					        except EnvironmentError as e:
 | 
				
			||||||
            raise exceptions.ConfigNotFoundError('Couldn\'t read config at one or more of {config_path}'.format(
 | 
					            raise exceptions.ConfigNotFoundError('Couldn\'t read config at one or more of {config_path}'.format(
 | 
				
			||||||
                config_path="\n".join(config_path),
 | 
					                config_path="\n".join(config_path),
 | 
				
			||||||
            ))
 | 
					            ))
 | 
				
			||||||
        except yaml.ParserError as e:
 | 
					        except yaml.YAMLError as e:
 | 
				
			||||||
            raise exceptions.ConfigSyntaxError('Error parsing YAML')
 | 
					            raise exceptions.ConfigSyntaxError('Error parsing YAML')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if 'printer' in config:
 | 
					        if 'printer' in config:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user