Python in Visual Studio Code

Moderator: Kathy_9

Post Reply
BloodyNose
Posts: 2
Joined: Sat Nov 23, 2019 1:06 am
operating_system: Windows 10
System_Drive: C

Python in Visual Studio Code

Post by BloodyNose »

I'm trying to edit my PSP 2021 python scripts within Microsoft Visual Studio Code. PSP correctly opens the file okay, but I'm having trouble getting the python libraries set up correctly. VSC in unable to import PSPApp: Unable to import 'PSPApp'. I've searched through the python libraries within the PSP 2021 install directory and find no references to PSPApp. What am I missing?

Thanks!
LeviFiction
Advisor
Posts: 5984
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8, 9, X, XI, X2, X8,X9, 2018, 2019
Location: USA

Re: Python in Visual Studio Code

Post by LeviFiction »

PSP uses a custom compiled and embedded version of Python. PSPApp is something provided by the main application not a physical file on the HDD.

I haven't found a good way to stop VSCode from complaining about PSPApp, but I have in the past just created my own version of the PSPApp library and placed it in my Python 2.7 libraries so I could use that as my interpreter in VSCode. It involved re-creating a number of the features of the PSPApp. But because I was lazy, instead of creating all of the constants and commands, I tried creating a class setup that would accept all member variables as valid. VSCode still complained.

I have a very basic run-down of that's all in the PSPApp library at the bottom of the page here: https://levifiction.wordpress.com/scrip ... mentation/ if you'd like to try and make your own.

EDIT: Just tried out the new PyLance engine in VSCode using my custom PSPApp library. All errors were removed. I also had to uninstall PyLint because that still complained but PyLance works. It removes all errors due to importing PSPApp.
I'm going to do some more work and get the Constants all loaded in so that I can have code completion on those. Once I'm done I'll upload a copy here.
Post Reply