-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial wrapper files generated in gen folder #114
Comments
After some more analysis of the information collected during this issue, I believe that the issue could have been due to the user closing the application while the cache files are being generated. Looking at the code generator, I see that it creates a cache file and writes the first two lines before it proceeds with resolving the dependencies. The rest of the code is buffered in to StringIO before making it to the file and if there's an interruption in between, it would not make it to the file and result in an incomplete file. I guess we can make this a bit more robust by:
|
* remove dependency with test_support * divide testcase into Test_GetModule and Test_CreateObject * add test methods * update import order * update import * to pep8-compliant line breaks * update docstring * align non-public function case like any other * make _invalidate_import_caches function * remove ugly KeyError catching * split creating friendly module from GetModule function * split loading ITypeLib from GetModule function * Rename variables as they really are * fix the timing of when module files are written, see #114 * update to use context manager * update to use print function * add dirname to _resolve_filename args * update assertion
I PRed #300 to fix this problem. |
…s in tools.codegenerator and client._generate. (related to enthought#114 and enthought#116)
Although #116 is closed without merging, the "Partial wrapper files generated in gen folder" can still occur. |
Maybe wrapper generation should become a transaction to guarantee full file generation or fail. |
I agree. The problem with the original implementation was that the first two lines of the generated code was immediately written to the file but the remaining lines were streamed to StringIO and later written to file. The partial file problem could occur when the execution is interrupted b/w these two steps. In my original PRs - I employed two strategies to solve this problem
|
With Comtypes 1.1.2 and Python 2.7.10
I have noticed that some times the generated wrappers have only the first two lines as below:
This manifests as issues such as:
AttributeError: 'module' object has no attribute 'XXXXX'
I had to delete the generated file and regenerate it to fix the issue whenever I see them. However I wasn't able to isolate the root cause and neither is the issue very frequent. After going through the github issues and searching over the internet, I don't see many complaining about such an issue. Only two instance that were discussed elsewhere seem relevant:
so I guess this is not specific to my setup but a generic issue.
The text was updated successfully, but these errors were encountered: