diff --git a/src/main/java/io/swagger/codegen/v3/generators/python/PythonClientCodegen.java b/src/main/java/io/swagger/codegen/v3/generators/python/PythonClientCodegen.java index 08c4541a36..f7e5a894e9 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/python/PythonClientCodegen.java +++ b/src/main/java/io/swagger/codegen/v3/generators/python/PythonClientCodegen.java @@ -174,7 +174,8 @@ public void processOpts() { } if (additionalProperties.containsKey(CodegenConstants.PROJECT_NAME)) { - setProjectName((String) additionalProperties.get(CodegenConstants.PROJECT_NAME)); + String projectName = (String) additionalProperties.get(CodegenConstants.PROJECT_NAME); + setProjectName(projectName.replaceAll("[^a-zA-Z0-9\\s\\-_]","")); } else { // default: set project based on package name