The post you reference in your question is almost 10 years old and appears to rely on Blender features and APIs that are no longer available.
The code is definitely not for an OSL shader - so using a Script node will not work - it's actually a python script.
The first 'import' statement attempts to import 'Node' from package 'Blender' - as far as I understand it, this was the old package for API calls to interface with Blender that has since been replaced with package 'bpy' (blender python).
It is possible to create such an effect in the compositor using a similar technique to that apparently used in the original script.
To achieve this in the compositor we need to be able to determine the location of each pixel in the image so that we can determine how far each pixel is from the a grid used to position each of the halftone circles, scaling the circles based on the brightness at that point. The pixel location isn't directly availabel to the compositor nodes but we can use Blend Textures, which vary across the image, and feed those into the compositor to derive the X and Y location.
Start by swapping to the Texture properties panel and click 'New' to create a new texture. Give it a meaningful name (such as 'HorizontalBlend', set the Type to 'Blend' and set the direction to Horizontal. Ensure the Progression is set to Linear.
Repeat for 'VerticalBlend' (click the '+' to add a new texture), setting the direction of this one to Vertical.
These textures can be accessed in the compositor to determine the X and Y location in the image.
In order to create the halftone pattern we need to be able to split the image into a series of grid cells. Each cell will represent one 'blob' of the halftone pattern whose size will depend on the brightness of the rendered image at that point.
The following nodes can be used to generate an array of 'blobs' that we can use for the halftone :
This will produce something like the following :
The position in the image is split into a series of bands by the Modulo function (smaller values produce narrower bands). This is then multiplied up to the range of 0.0 to 2.0, 1 is subtracted (so the range is -1.0 to 1.0) and the Absolute node reverses the sign of the negative values. This results in a value that starts at 1.0, reduces to 0 at the grid line, and increases back to 1 - ie, the distance from the grid line. The same is done in the other dimension and the results combined (with pythagoras - a^2 + b^2 = c^2) to give the distance from the centre of each circle.
We can turn this into the halftone image by simply comparing the distance to the nearest centre with the brightness at the current point in the image. This produces the following rudimentary halftone :
To refine this a bit we can slightly change the pattern by offsetting each alternate row - this will produce a hexagonal arrangement of blobs that produces a more pleasing result :
Adding Mix nodes we can add a splash of colour for the two halftone shades and the background (set to black by setting Environment Ray Visibility to disable visibility to the camera) and the foreground (drawn using Freestyle as white lines) and nodes to allow fine tuning of the halftone (the Divide and Subtract nodes).
To finish this off we can add nodes to allow the horizontal and vertical dot pitch and better adjustment for the colours, brightness and contrast as well as Blur nodes to allow the effect to be softened (blurring before the halftone removes hard edges and fine detail that would interfere with the pattern, whereas the blur after the halftone softens the 'blobs' themselves) to produce the following nodes :
By unchecking the camera visibility of the environment (so it appears black) and by adding pure white edges using Freestyle we can achieve the following result :
Blend file included
I've extended this to produce a colour halftone by simply splitting the image channels, duplicating the nodes, and re-combining the result. You could potentially change the dot pitch on each channel for different halftone effects.
Here's the node tree (apologies for the scale but it's included in the blend below) :
The coloured original :
And the coloured halftone :
Blend file included
You can also experiment with the dot pitch to use different pitch per channel. For example :