TOPIC: WORKSPACE
Getting custom Python imports to work in Visual Studio Code
18th February 2022While I continue to use Spyder as my preferred Python code editor, I also tried out Visual Studio Code. Handily, this Integrated Development Environment also has facilities for working with R and Julia code as well as Markdown text editing and adding the required extensions is enough for these applications; it helps that there is an unofficial Grammarly extension for content creation.
My Python code development makes use of the Pylance extension, and it works a little differently from Spyder when it comes to including files using import statements. Spyder will look into the folder where the base script is located, but the default behaviour of Pylance is that it looks in the root path of your workspace. This meant that any code that ran successfully in Spyder failed in Visual Studio Code.
To solve this issue, I added the location using the python.analysis.extraPaths
setting for the workspace. I opened Settings by going to File > Preferences > Settings in the menu. I typed python.analysis.extraPaths
in the search box. This showed me the correct section. I clicked on Add Item, entered the required path, and clicked OK. This resolved the problem, and everything worked properly afterwards.
Adding workspaces to Windows
1st July 2010One of the nice things about working with Linux/UNIX is that you can organise your open applications so that they are open in different workspaces or virtual desktops. When I return to working on Windows, having everything open on the same desktop is something that I find less tidy. However, there is an open source application that adds virtual desktops to Windows and very useful it is too.
It is called VirtuaWin, and it adds an icon to the taskbar for switching between workspaces when it is running; there might be a bit of tweaking to be done for it to stay visible all the time, though. You can have it as a startup application in the same way that you have your security software, and I have been using it smoothly on both Windows XP and Windows 7 running in VirtualBox virtual machines. Insofar as I have seen it, you can have as many workspaces as you want and switching from one to another is achievable using keyboard shortcuts. Using CTRL, ALT and one of the arrow keys does it for me, but you can set up your own. All in all, it's a small download that brings a little sense of Windows desktop computing.
A collection of lessons learned from using Eclipse on Ubuntu
9th July 2008I have been running into a few woes on the home computing front that may or may not give rise to a number of posts on here. While having my Windows VM's going awry on VMware is a more worrying development with my need to use a Windows-based application for my hillwalking mapping, I am going to devote this entry to a spot of bother that I started to have with Eclipse, if only because I managed to sort that one out.
Up to yesterday, I had all my offline website development stuff in a single project area for the sake of ease of testing. I suppose that I got led into this by my use of Dreamweaver and the way that it sets up what it calls Sites. Applying that same of working to Quanta Plus and NetBeans just chokes up the respective IDE's and makes them less usable. Until recently, Eclipse escaped this because it seemed to check if a file had changed when you tried editing it and asked you if you wanted the latest version. This stopped in the last few days for whatever reason, and it started to stall just like the others.
Naturally, I wanted to set it back as before, so a certain amount of investigation was in order. I ended up refreshing my installation in /usr/lib
, a manual extraction of the Eclipse PDT archive, only for that not to resolve the issue. In fact, it created another one that we'll talk about later. Creating a smaller project made it all work again, and I'll be building up a number of these.
The new issue pertained to the creation and selection of the Eclipse workspace. While there was no problem using what I wanted it to use, it wouldn't remember the setting. There was more blundering about before I happened on the cause: access permissions. Then, I copied the new Eclipse files in as the root user, and that meant that Eclipse couldn't update its setting when I was running it under my own account. Running the editor using sudo sorted out the workspace selection issue for now, but a more permanent fixing such as giving myself write access to the configuration directory and its contents remains an outstanding task.
The mention of the Eclipse workspace brings me back to the way that it was working before the upheaval hit me. It does keep a copy of every file that you edit in there, and maybe more besides. Thus, having a copy of every file in the project would have meant that it didn't need to do the constant churning being performed by Quanta or NetBeans. That's the impression that I have, so I'll stick with smaller project bundles from now on. Learning all this was useful.
Navigating multiple workspaces: A Linux and UNIX advantage over Windows?
16th November 2007One of the nice things about the world of Linux and UNIX is the availability of multiple workspaces. In Window, you only ever get one, and the likes of me can easily fill up that task bar. So the idea of parcelling off different applications to different screens is useful from a housekeeping point of view so long as icons only appear in the task bar for the open workspace; Ubuntu respects this but openSUSE doesn't, a possible source of irritation.
However, a case can be made that UNIX/Linux needs workspaces more than Windows because of the multi-window interfaces of some of the software applications. The trouble with each of these sub-windows is that an entry appears in the task bar for each of this, rapidly creating a mess. And it can also be an issue working out which window closes the lot.
Examples of the above that come to my mind include GIMP, XSane and SAS. The Windows version of the latter's DMS is confined to a single application window while the UNIX incarnation is composed of a window each for individual components like program editor, log, output, etc. Typing "bye" in the command line of the program editor is enough to dispatch the GUI. With GIMP, Ctrl+Q will close it down in any window, apart from the "Tip of the Day" one that pops up when GIMP is started. The same sort of behaviour also seems to dispatch XSane too.
Switching from one workspace to another is as easy as clicking the relevant icon in the task bar in all the UNIX variants that I have used. Switching an application from one workspace to another has another common thread: finding the required entry in the application window menu.
On Ubuntu, I have seen other ways of working with workspaces. In the interface with visual effects turned off, hovering over the workspace icons in the task bar allows you to move from one to another with the wheel of your mouse. Moving an application between workspaces can be done as simply as dragging boxes from one task bar icon to another. Turning on the visual effects changes things, though. It might appear that the original functionality still works, but that seems not to be the case: a matter for Canonical to resolve, perhaps?
The visual effects do provide other ways around this, though. Keeping all your application windows minimised means that you can run through workspaces themselves with your wheel mouse. Moving applications between workspaces becomes as simple as grabbing the title bar and pulling the window left or right until it changes workspace. Be careful that you do the job fully, though, or you could have an application sitting astride two workspaces. It would appear that ideas from the sharing of a desktop across multiple monitors have percolated through to workspace behaviour.
Aside (regarding Ubuntu visual effects): I don't know who came up with the idea of having windows wobble when they're being moved around, but it certainly is unusual, as is seeing what happens when you try prising a docked window from its mooring (particularly when you're pulling it up from the bottom task bar). The sharper font display and bevelled screen furniture make more sense to me, though; they certainly make a UI more appealing and modern.