Jump to content

Loading Houdini Python modules into Code Issues


CinnamonMetal

Recommended Posts

  • 2 months later...
  • 5 months later...

Hi,

Im new to python, Im trying to use vscode as external editor but it really sucks at being intuitive for a beginner...

Im trying to add the hou.module so I can see the functions but Im getting this error:

The setting 'python.autoComplete.preloadModules' is deprecated, please consider using the new Language Server ('python.jediEnabled = false').

my settings.json looks like this:

{
    "python.pythonPath""C:\\PROGRA~1\\SIDEEF~1\\HOUDIN~1.287\\python27\\python.exe",
    "python.linting.pylintEnabled"false,
    "python.linting.enabled"true,
    "python.linting.flake8Enabled"true,
    "[python]":{},
    "python.jediEnabled"false,
    "python.autoComplete.extraPaths": [ "C:\Program Files\Side Effects Software\Houdini 18.0.287\houdini\python2.7libs\hou.pyc" ],
    "python.autoComplete.preloadModules": ["hou"]
}

Also wheeve I edit a .py Code tells me: Linter flake8 is not installed. And when I click Install is says: There is no Pip installer available in the selected environment. 

Im using:
Windows 10
Houdini 18
VS Code v 1.41.1
Python v 2.7.15 64-bit

 

 

Link to comment
Share on other sites

Thanks, I overlooked that.

...it doesn't give me the error now, but it still doesn't recognise the hou.module classes :/ 
(Ive tried without the [ ] brackets too)

Im using:
Windows 10
Houdini 18
VS Code v 1.41.1
Python v 2.7.15 64-bit

Edited by makah21803
Link to comment
Share on other sites

  • 8 months later...
On 1/14/2020 at 12:29 AM, makah21803 said:

Thanks, I overlooked that.

...it doesn't give me the error now, but it still doesn't recognise the hou.module classes :/ 
(Ive tried without the [ ] brackets too)

Im using:
Windows 10
Houdini 18
VS Code v 1.41.1
Python v 2.7.15 64-bit

Any news?

Link to comment
Share on other sites

  • 2 weeks later...
"python.analysis.extraPaths": [
    "C:\\Program Files\\Side Effects Software\\Houdini 18.0.597\\houdini\\python2.7libs",
],

"terminal.integrated.env.windows": { 
    "PYTHONPATH" : "C:\\Program Files\\Side Effects Software\\Houdini 18.0.597\\houdini\\python2.7libs",
    "PATH" : "${env:PATH};C:\\Program Files\\Side Effects Software\\Houdini 18.0.597\\bin"
},

"python.languageServer": "Pylance",

That's what you need to have in settings.json.

VS Code will only show autocompletion if Project Folder is opened and File is saved in that folder (at least it's that way for me).

If I need to write a bit of a Python for current project, I don't open editor from Windows menu of Houdini, I just open houdini_temp directory as project folder in VS Code, and edit code directly in __python_source_editor.py.

And if you want to edit code from Python Wrangle node, then just after file opened in VS Code, save it with the same name, so Pylance could pick up it (and Project Folder should be already open).

That's what worked for me in my case.

 

5f8bf3326349e_Screenshot-2020-10-1818_47_44.png.a24140446090f3a0d6ecb84afe3ab5b4.png

 

 

Edited by sefisec
Link to comment
Share on other sites

  • 1 month later...
On 10/18/2020 at 10:48 AM, sefisec said:

"python.analysis.extraPaths": [
    "C:\\Program Files\\Side Effects Software\\Houdini 18.0.597\\houdini\\python2.7libs",
],

"terminal.integrated.env.windows": { 
    "PYTHONPATH" : "C:\\Program Files\\Side Effects Software\\Houdini 18.0.597\\houdini\\python2.7libs",
    "PATH" : "${env:PATH};C:\\Program Files\\Side Effects Software\\Houdini 18.0.597\\bin"
},

"python.languageServer": "Pylance",

That's what you need to have in settings.json.

VS Code will only show autocompletion if Project Folder is opened and File is saved in that folder (at least it's that way for me).

If I need to write a bit of a Python for current project, I don't open editor from Windows menu of Houdini, I just open houdini_temp directory as project folder in VS Code, and edit code directly in __python_source_editor.py.

And if you want to edit code from Python Wrangle node, then just after file opened in VS Code, save it with the same name, so Pylance could pick up it (and Project Folder should be already open).

That's what worked for me in my case.

 

5f8bf3326349e_Screenshot-2020-10-1818_47_44.png.a24140446090f3a0d6ecb84afe3ab5b4.png

 

 

Thanks, that helped. Also worth mentioning, that vcode needs to be restarted for changes to work.

Link to comment
Share on other sites

  • 1 month later...

I did what @sefisec said. But it is still not working. Here is my settings.json

I'm getting Pylance(reportMissingImports)

{
	"workbench.startupEditor": "newUntitledFile",
    
    "[python]": {},
    "files.defaultLanguage": "python",
    "editor.cursorSmoothCaretAnimation": true,
    "workbench.editorAssociations": [],
    "python.pythonPath": "C:\\Python27\\python.exe",
    "python.languageServer": "Pylance",
 
    
    "python.analysis.extraPaths": [
        "C:\\Program Files\\Side Effects Software\\Houdini 18.5.531\\houdini\\python2.7libs",
    ],
    
    "terminal.integrated.env.windows": { 
        "PYTHONPATH" : "C:\\Program Files\\Side Effects Software\\Houdini 18.5.531\\houdini\\python2.7libs",
        "PATH" : "${env:PATH};C:\\Program Files\\Side Effects Software\\Houdini 18.5.531\\bin"
    },
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...