Posts tagged #Windows

Add Custom Python3 Modules Path (Windows / MacOS)

After installing Python on Windows or MacOS, the installer makes sure that everything works fine. All paths are available/accessible for Python. Adding modules through pip also works just fine.

The problem is that the paths used are hard to remember (e.g. Windows: c:\Users\<username>\AppData\Local\Programs\Python\Python37\), so if you want to use some custom modules you have to use the (complex) default structure, or you can use your own.

Using your own directories for custom modules requires adding the path(s) to the environment variable PYTHONPATH.

Windows

After installing Python, the installer add the PYTHONPATH environment variable to Windows. All you need to do is add your custom path to this variable.

The environment variables can be found through:

This PC -> Properties -> Advanced Settings -> Environment Variables

In screenshots:

MacOS

On my MacOS devices I had to add the path(s) to 2 different files because (regular) GUI based programs (like Pycharm and Python IDLE) use different environment variables than the terminal / console interpreter.

GUI-Based programs

Create a startup plist file (e.g. ~/Library/LaunchAgents/my.startup.plist) and add the following XML content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>launchctl setenv PYTHONPATH ~/Python_Scripts/_my_modules</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

The string ‘~/Python_Scripts/my_modules/’ points to my custom module directory. Edit this to reflect your own directory structure. If you need multiple directories you can add these by seperating them by using a colon (:) e.g.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>launchctl setenv PYTHONPATH ~/Python_Scripts/_my_modules:~/Desktop/my_scripts</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

To makes these changes active you can either reboot, log-out/log-in or execute the following command:

launchctl load ~/Library/LaunchAgents/my.startup.plist

Terminal / Console

For the terminal / console based Python interpreter you need to add some lines to the ~/.bash_profile or ~/.zprofile file (depending wether you use bash or zsh as shell).

PYTHONPATH="~/Python_Scripts/_my_modules:$"
export PYTHONPATH

Multiple directories can (again) be added by using the colon seperator (:):

PYTHONPATH="~/Python_Scripts/_my_modules:~/Desktop/my_scripts:$"
export PYTHONPATH

To activate this, just quit the open terminal/console windows (CMD-q) and open it again.

Posted on November 7, 2019 and filed under Programming, Tips'n Tricks.

Windows Phone 7 Series

Windows Phone 7 SeriesMicrosoft will be shipping a new phone operating system this year. After the Windows Mobile brand, they're switching to an alternate name; Windows Phone 7 Series. And obviously, with a new name comes a new website; http://www.windowsphone7series.com.

I can't really see why they keep bothering trying to access the phone market. Every single Windows Mobile (or Windows CE as it was called in the old days) device I've owned crashed more frequently than the 'good old' Windows Millennium Edition on an average Sunday. I can't count the number of times that I received a phonecall while doing something else (e.g. playing solitaire, or reading e-mail) and that the call finally went to voicemail. Why? because the phone froze, crashed, or answer button was unresponsive.

Posted on February 15, 2010 and filed under Hardware, Microsoft, Software.

Microsoft Haunted by 17-year old 'feature'

It looks like that every Windows version is susceptible to a 17-year old 'feature' that could give hackers access to your computer. The 'feature' exist since Windows v3.51, which dates from the last century (this way it looks even older :-) )

The person (Tavis Ormandy) who discovered this feature did a full disclosere which can be found here. So you'd better start watching your 3.51 Operating Systems (and above).

Posted on January 22, 2010 and filed under Microsoft, Operating Systems, Security.

Why I F#cking Hate Windows

Yes, you read it correctly. I f#cking hate windows. Why? Well, let me explain;

Microsoft has this nice feature called Automatic Updates. Basically nothing wrong with that. It makes sure that you have the latest patches and updates without having to think too much about it.

Every now and then you get a mildly annoying question if you want to reboot (no, off course not... I'm working at this moment), but you can postpone those during the day. So when you shutdown the laptop/PC at the end of the day, the changes are taken into effect, and you can be (pretty) sure that your system is up-to-date the next time you boot it up.
So far nothing wrong.......

Somehow there are certain updates which enforces a reboot of itself (see the screenshot below). This is a reboot from hell, because no matter what documents you have open, no matter how many things you need to save before restarting. This bug-from-hell (I have no other words for it), will close everything by force and reboots your system. And with force I really do mean force.

Automatic Update Reboot Automatic Update RebootNormally, when you close a program, you get a question if you would like to save the document if it has changed. Even when you shutdown the PC the official way, the shutdown process stops (actually, it hangs, because stuff stops responding) at those dialogs. Waiting for your input. But this enforced reboot ignores this all together.

After the first message appears on your screen you've got exactly 5 minutes to change its mind. So if you're at lunch, or on the toilet, you might be in deep sh#t. Because when you come back, the OS has rebooted. Every open document (saved or NOT) is closed, and you can start over again.

The worst part is that a unwanted shutdown can (and will at some point) corrupt data. Something you don't want, but just happened to me....

Damages:

  • Corrupt Outlook PST file
    which was an archived mail file, which can be recovered from an earlier backup.
  • Corrupt MS-Word document
    thankfully the auto-save function was enabled and recovery seemed to work. No idea what content is missing yet.
  • Lost several notepad files which were open with several to-do things, and pieces of code I was working on.

And that's why I love Apple OSX, and f#cking hate Windows.

B.t.w. I already blogged about this feature a while back, but I hadn't lost any data that time. This time it's personal.

Oh, and spare me the advise on reconfiguring Automatic Updates, because this feature should not even exist.

Posted on June 12, 2009 and filed under Annoying, Microsoft.

Windows/Office Frustrations

The title should cover the topic appropriately.... The last couple of days there's this delay on opening Office documents on my work laptop. Every MS-Word or Excel document I open (by double clicking the document) takes approximately 25 to 30 seconds to open.

Using tools like procmon (formerly known as filemon from SysInternals) displayed nothing interesting. Apart from a 15 to 20 seconds delay between the WINWORD.EXE appearances in the logging.
Since this nagged the hell out of me, I tried some stuff (in a non-chronological order);

  • Removed McAfee AV
  • Removed all tooling I installed in the last couple of days
  • Removed  MS-Word
  • Removed Office 2003 completely
  • Removing all references to Office, MS-Word or Excel in the registry, and on the filesystem.

Running Word with the /a switch or even typing winword.exe c:\test.doc works fine. Everything works, except the default opening of a file by double clicking it.

Someone suggested to add another user on the system and try it with that user account. So I did. I logged on as the new user and every document launched as it's supposed to do :-) . So I logged out, and tried the original user, and guess what? The document opened lightning fast. I couldn't be more happy, because I didn't feel like reinstalling the entire system.

After working a couple of hours I restarted the system (application update), and everything went back to 'normal'... Opening documents took forever again.....
It seems that launching Word from a FRESH user account resets something. Everything afterwards works fine, just as long as you don't reboot... And since it's Windows...... Well, Friday is gonna be a re-installment day. Am I looking forward to that (that's something of a rhetorical thing).

Posted on July 16, 2008 and filed under Annoying, Microsoft, Operating Systems, Personal, Software.

Ubuntu 'Hardy Heron' Released

As of yesterday, the latest Ubuntu release 'Hardy Heron' is available for download (both client and server). Every time a major Linux distri(bution) hits 'the shelves', the Linux community roars. With each release (Ubuntu or whatever flavor) the Linux community gets closer, and closer to Windows.

Even though the OS itself is getting better and better. It still lacks the support of decent major software like Adobe Creative Suite, etc. It's missing the software people use in every day (business)life.
Sure, there a million different ways of running Microsoft Office or Adobe Photoshop on a Linux OS, but these require a commercial piece of software (CrossOver) , or in depth knowledge of the OS to make it work (Wine in some cases). Two things that shouldn't be required. Not if you're used to Windows (or Apple's OSX). And even if you find a 'substitute' it's most likely to have an awful user experience.

The average housewife won't use Linux, because her friends all use Windows. All those nice little Windows programs, which makes life easier (or a living hell with all the mal/spyware out there). So if the Linux community wants to make a difference they need to create some sort of critical mass (by their selves, or by Microsoft screwing up) to get the attention of the 'normal' user. But in a community where there's no real (commercial) business model, it's gonna be damn hard.

Microsoft created this critical mass by playing (probably) the best marketing trick in the world; Release Windows 95, and turn a blind eye to those who use a pirated copy at home. The home users create demand on the workfloor, so businesses start to use it on their workstations. Soon everyone was addicted. And now it's damn hard to beat the addiction.

B.t.w., Apple is doing it a lot better. They created a nice and stable OS (just like the average Linux desktop distribution), BUT the OS has ALL the relevant drivers for the hardware used. ALSO they have a complete (and cheap) software suite (iLife and iWork), which is more than enough for the average family. No need to search the caverns of the Internet for software, and they look and feel the same as the OS.

So, I guess that my conclusion is that the OS is nearing perfection, but it (Linux in general) lacks good and decent third party software (and a good marketing machine :) )

In the mean time; I'm gonna upgrade my Linux (mail, web, and ssh) servers at work to 'Hardy Heron'.