Importing PythonScript Library to IDE
-
So you are using some other IDE’s editor to edit code that is supposed to be run only inside Notepad++ with the PythonScript plugin? It seems almost heretical to try to answer you at all. And you won’t be able to run the scripts in your IDE: the PythonScript classes requires Notepad++ & PythonScript together to be a valid environment for running the scripts.
If you want the IDE-extras for syntax highlighting and marking errors and navigating your project, you should really look for the recent discussions on the LSP language server plugins that a couple of people are developing – IIRC, I think @Ekopalypse’s examples show how to use his alpha/beta-level plugin with a language server that understand Python, so it should give you the IDE-like environment.
PythonScript stores the libraries it uses in
C:\Program Files\notepad++\plugins\PythonScript\lib
or equivalent. But I’m not confident that it would help you, because those look like the “standard” style libraries, just installed for the DLL version of Python that’s included with PythonScript. I think that the actual PythonScript classes (Npp, Notepad, Editor, and the like) are defined in the compiled source code for the PythonScript DLL, not in standalone .py or .pyc files. So I don’t think just pointing your IDE at the PythonScript\lib directory would work for you.If I am wrong about that, then, in general, you would make the IDE aware of the libraries that PythonScript’s python uses in the same way you would tell that IDE about any other library that’s in a non-standard location (relative to that IDE’s python instance). And how you do that is a matter of a question for that IDE’s forum (“how do I tell /insert_IDE_here/ to give python an extra search directory, so it can find a library installed in a non-standard directory, so that it won’t mark functions from that library as syntax errors”), or a Python forum (“how do I tell Python to find a library in a non-standard directory that’s not part of its normal library hierarchy”) – not a question for the Notepad++ editor forum.
Once again, if you are asking the question this way, I think you are asking the wrong question, and you are going to give yourself a headache trying to solve your actual problem with your attempted solution, no matter how many hoops you have to try, rather than asking for help with the underlying problem and being willing to accept a different perspective. (You have, once again, what’s known in the business as an “XY problem”. This was your same difficulty from the column-select discussions – you were so focused on trying to do it your way and just wanting help with that specific way, that you couldn’t see how much easier and better it could be solved from a different direction.)
I believe the question you really have is “I want IDE-like features A, B, and C while editing my PythonScript scripts in Notepad++. How can I get those same features in Notepad++? Since I didn’t know how, I came up with the idea of trying to point my other IDE to the PythonScript libraries … but when I try, that IDE is always claiming that the PythonScript classes/methods are errors: is it a good idea to go down that path, and if so, how would I do it?” Then we could have given hints (like the LSP plugin) without having to fight as many preconceptions.
–
Edit: “Seeking for help” is the discussion I was thinking of. Both @Ekopalypse and @Derek-Brown are working on LSP clients for Notepad++: that thread is about Ekopalypse’s version (and includes examples of using it with Python). And Derek shared an early preview version of available in a later discussion. -
@john-doe-1 said in Importing PythonScript Library to IDE:
The reason for this is that syntax highlighting/checking is one of the most useful features of any IDE
What “syntax highlighting” features are you looking to obtain? Notepad++ itself lexes Python files?
What kind of “syntax checking” are you seeking?
Maybe some explanation of what you want to “take full advantage of” helps in answering the questions.
-
@alan-kilborn said in Importing PythonScript Library to IDE:
What “syntax highlighting” features are you looking to obtain? Notepad++ itself lexes Python files?
Yeah I am aware of that, I am just very used to PyCharm (and the JetBrains IDEs) (They also integrate with GitHub which can be very useful). I understand you could also accomplish this on Notepad++.
-
@peterjones said in Importing PythonScript Library to IDE:
“I want IDE-like features A, B, and C while editing my PythonScript scripts in Notepad++. How can I get those same features in Notepad++? Since I didn’t know how, I came up with the idea of trying to point my other IDE to the PythonScript libraries … but when I try, that IDE is always claiming that the PythonScript classes/methods are errors: is it a good idea to go down that path, and if so, how would I do it?”
I really would like to be able to use PyCharm since I am so familiar with it and it already has all the features I need, I am aware you can program Python in Notepad++. So I guess it is not possible to import the Npp library to an IDE then? I guess I will keep going on as I have been or settle for using Notepad++ in place of an IDE.
-
Yeah I am aware of that, I am just very used to PyCharm (and the JetBrains IDEs) (They also integrate with GitHub which can be very useful). I understand you could also accomplish this on Notepad++.
The bullet-point version:
- This is not a PyCharm forum
- We will not answer PyCharm questions here, as being completely and totally off-topic (it’s like asking in a Android forum how to use an iOS-only app)
- PythonScript has some libraries at
c:\Program Files\Notepad++\Plugins\PythonScript\lib\
.- So any external tools/resources that need to see those libraries need to be pointed there
- We cannot tell you how for your individual tools/resources how to point them there. That’s a question specific to the other tools/resources
- PythonScript implements some of its functionality in compiled code, not
.py
/.pyc
in the folder mentioned- This includes, AFAIK, the Npp, Console, and Editor classes/objects
- Thus, even if you do point things to the libraries used by the PythonScript
python.dll
, you probably won’t be able to see the PythonScript specific
I really would like to be able to use PyCharm since I am so familiar with it and it already has all the features I need,
What does you wanting to use PyCharm have to do with Notepad++? Using that tool is your prerogative… but asking about it here is 100% off-topic.
I am aware you can program Python in Notepad++. So I guess it is not possible to import the Npp library to an IDE then?
What you seem to not be aware of is that scripts written for PythonScript use Python, plus some code that is implemented inside the PythonScript DLL. PythonScript is not just some singular
.py
file that implements all the classes and objects used for automating Notepad++.So I guess it is not possible to import the Npp library to an IDE then?
Since it’s embedded in the PythonScript.dll, probably not.
I guess I will keep going on as I have been or settle for using Notepad++ in place of an IDE.
Our job is to talk about Notepad++. We try to encourage people to use it, and to help them get the most out of their Notepad++ experience. Helping you get the most out of your PyCharm experience is completely off topic.
If you ever choose to learn how to do things in Notepad++, since that’s the topic of this forum, we will be happy to help you out – by pointing out features that already exist, or are in plugins or plugins-being-developed; by explaining workarounds for features that aren’t there yet; or commiserating when there’s a feature we like that there isn’t something for yet.
But as of the point in which you emphasized that you want to continue using PyCharm for your Python editing, we had already told you that some of the objects, including the Npp parent and the Notepad and Editor object classes, are implemented in the DLL.
Your persistence in going down the wrong path, even when we’ve already told you it’s wrong, makes it very hard to help you.
I will say this as plainly as possible: This is a Notepad++ forum. Please restrict your discussions to Notepad++ itself. If you stray, we will tell you (and let you know why it’s off topic), but continuing to ask us how to do off-topic things after we’ve explained why it’s off topic is not polite behavior in any forum I’ve been involved in my nearly 30 years of having my own accounts on the internet . - This is not a PyCharm forum
-
@peterjones Okay, my apologies. From what you’ve mentioned it does not seem to be possible. I’ll keep any PyCharm or other IDE questions off this site, sorry about that.
-
So it is an intriguing idea. Sometimes “different thinkers” are needed to jolt everyone that is “set in their ways” into seeing things in a new light.
I mean, if it was all of a sudden possible that PythonScripts could be single-step debugged (the only real advantage I can think of) in PyCharm, I would certainly give it a try.
Otherwise, Notepad++ is enough of an IDE for me, for doing PythonScripts.
BTW, Notepad++ really doesn’t try to be an IDE … it is too general purpose. So much so that I ask why you are even using it, if you have such an affinity for PyCharm.
-
I am part of the Notepad++ Community Forum because the first time I came here, years ago, to ask a simple Notepad++ question or two, I got very helpful and friendly answers… and I saw that I was sometimes able to answer other people’s questions as a way to “pay back” the Community for the help I had been given. And soon, the joy of helping others with a nice tool had taken over, and I became a regular contributor.
So every time I start answering a question, it is my goal to help the person who asked, and to help them learn, and to help them enjoy Notepad++ more (or at least use it with more skill).
But every once in a while, I come across someone asking for help, that no matter how many different ways I try, I cannot seem to get my point across in a way the asker will understand – and my joy at helping turns into extreme frustration. Unfortunately, in my intense desire to change things, I keep pressing forward instead of stepping back like I should, but that usually leads to me saying things in a way I regret, but cannot take back.
After my last post, it was made known to me that I have passed that point, and am not seeing things clearly or focusing on helping like I want to do. As a result, I will be taking a step back for a while, at least from certain topics.
So I am sorry, and hope I haven’t chased you off.
If you would like to get help in trying to get more IDE-like behavior out of Notepad++, feel free to ask such questions here – there are plenty here (including others more able than I) who would love to help you get more out of Notepad++ than you currently do. Good luck, and I hope you are able to continue to use Notepad++ for at least some of your text-editing needs, even if it’s not your favorite environment for Python programming.
-
@peterjones ,
I don’t know who told you that, but I thought your reponse was quite appropriate, instructive in it’s explanation and to the point, which is what I think is most important in a discussion. Any thing aftwards is meant to persuade the reader to see what you’re saying in different ways. Self flaggelation is not required here. The thing I remember most about being young (I’m still immature, just not young :) ) is that when someone told me something was impossible, it made me try harder to accomplish it, or learn by failing why it was impossible (or extremely difficult to do easily). I find, I needed people to tell me things were impossible to force me to look at other ways to accomplish things.In this case, like the older folks who were either wiser or just set in their ways, they just relented and allowed me to find out myself, success or failure. When I would ask instructors questions that were outside their area of expertise or knowledge, I was met with the advice that has fashioned me for most of my life. “Find out yourself”. Or as mother put it, “Look it up, yourself”. With the best of intentions and in what I saw as a tactful, yet assertive way, you have tried to corral this youngin’ into understanding that there are limits to some people’s knowledge, which is why a community exists to pool mass knowledge. However, lost on youth is the need for focus of that information, and arguing something can be done which may or may not be capable, does not belong anywhere willy nilly. I often times find myself just making notes of dicussions, and moving on as the material is either outside my knowledge or interest. You have such a breadth of knowledge about this product, albeit, passionate, you find it hard to NOT have the answer. Like those old folks that couldn’t answer my questions, perhaps with a gentle nudge (as you did) that the youngin needs to focus his questions to the applicability of NPP, and not another product is the all you can do. If enough folks can’t answer him, he’ll move on, on his own to find out one way or another.
My purpose for writing this, is to let you know I saw nothing wrong with your response, even the overwritten part, and hope you can forgive yourself for not having all the answers (as none of us do), but do keep your passion, regardless, as we all need that one thing that brings us happiness, even if it’s only being able to say, we don’t know everything as much as we want to. :)
Perhaps, just make quick reminders to stay on topic (NPP) when youngin’s are trying to push envelopes, and move on reading if you’re intersted, ignoring if your not, and just making the notes that you do of where you saw a conversation about similar subject for the improvements of others interest in something similar. Please, keep up the good work. I learn from you even when I at first don’t understand because you take the time like most good communicators to find the common ground, most of the time, with those you converse with.
-
@peterjones There’s no need for an apology, you’ve been a great deal of help in learning Notepad++ development. I truly appreciate all of the demonstrations you’ve provided and they were very helpful. I would advise you not to take a break from this forum, you’ve helped a lot and I am sure there are others that could use your assistance. I can be a bit hard headed at times which can lead to frustration and I am sorry for that. Have a great one! : - )