Autocomplete for compiled extensions?

I would like to know how to get PyCharm's autocomplete working for a third-party library that I have only the .pyc file for.  The sole other example I've found references the .pyc, .py and.pyd files.

I apologize if this is a newbie and/or silly question.  I am trying to learn Python specifically so I can use this third-party library (it's the new Python interface for Lightwave 3d.)   This library is huge and not well documented, so code completion would save me a HUGE amount of pain.   

I've tried dropping the .pyc file in the "site-packages" folder, but no luck.  Can anyone tell me what I'm doing wrong, or if this is even possible?
6 comments
Comment actions Permalink
Hello Tom,
After you put the .pyc in site-packages, please try to open Settings | Python Interpreters and press the "Reload" button in the Paths tab. Then PyCharm should generate a .py stub for your .pyc file.
0
Comment actions Permalink
I was able to get it to reload by dropping and creating a new virtual environment.   Unfortunately, when it tried to reload I got this message:  "Some skeletons failed to generate: 1 modules failed in 1 interpreters."

Clicking on the "Details" link I got this "Skeleton Generation Problems"  dialog box:   "Python 2.7.3 virtualenv at C:\Users\tomw\test2\test1  - lwsdk - Generation of skeletons for the modules above will be tried again when the modules are updated or a new version of generator is available."

It looks like this issue:   http://youtrack.jetbrains.com/issue/PY-7691

Is there anything else I can try at this point or am I pretty much dead in the water?
0
Comment actions Permalink
Please attach the log file (Help | Reveal Logs)
0
Comment actions Permalink

idea.log (15KB)

Here's the log file.    I apologize for being such a Python noob.   I have installed both the 32 and 64 bit Python 2.7.3 packages (don't know if that is important).   Some additional interesting information:

The module I actually want to import is "lwsdk".   I tried dropping it into the global site-packages and importing it into IDLE, and got the following complaint:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import lwsdk
  File "lwsdk.py", line 10, in <module>
ImportError: No module named pcore

So I added the "pcore.pyc" module.   That led to this:


Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import lwsdk
  File "lwsdk.py", line 10, in <module>
  File "pcore.py", line 26, in <module>
  File "pcore.py", line 18, in swig_import_helper
ImportError: No module named _pcore

Sure enough, I found a module called "_pcore.pyd" and dropped that one in as well.   That led to this mysterious message:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import lwsdk
  File "lwsdk.py", line 10, in <module>
  File "pcore.py", line 26, in <module>
  File "pcore.py", line 22, in swig_import_helper
ImportError: DLL load failed: The specified module could not be found.


Now I'm not sure what to do.   If you can help me in any way with this I would appreciate it.   Thanks.
0
Comment actions Permalink
It's likely that the .pyd file depends on some Lightwave DLLs. Instead of copying files to site-packages, please try to add the path which originally contained the files to the list of paths for the interpreter you use under Settings | Python Interpreters.
0
Comment actions Permalink
No luck with that, I'm afraid.   I no longer get errors, but I also get no code completion.   I have sent an email to the product manufacturers asking for support - I'll let you know if I get any help from them.

Thank you for your time and your patience.
0

Please sign in to leave a comment.