Chapter 3 lab-- building an index

In building an index in the foreground lab and running python script “building_index_in_foreground.py” the following error message is created:

python building_index_in_foreground.py -p 30000 - h localhost
Traceback (most recent call last):
File “building_index_in_foreground.py”, line 18, in
eval(compile(d(code), “”, ‘exec’))
File “”, line 81
print “Looks like the employees collection is already present.”
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(“Looks like the employees collection is already present.”)?

help – I am using Python 3.7.3 on my machine… I know the syntax is the issue, but can not fix it. Have fixed script using base64 decoder/encoder, but seems to not run on my machine (windows 10) by calling python:

python building_index_in_foreground.py -p 30000 - h localhost
Usage:
./building_index_in_foreground.py [options]

Will accept any recommendations!

Incompatibility issues. print is one of the Python functions that has been refactored/deprecated in later versions.

Suggest you use the VM as per the lab or install 2.7.6 (which is what the VM comes with). And if you do decide to downgrade to an earlier version, you never know what other problems you’re going to face further down the line, so it really is best to just use the VM.

I have docker desktop set up with Hyper-V on the machine I use. The setup for the class VM can cause issues.I addressed the script issues for Python. As noted the issue is now running the python script on windows. It fails with the message indicated.

I see… a downgrade on your VM should do the trick.

Unsure of what you are saying… downgrading VM?? I am not using a VM, that is the point

Just a typo… Downgrade python

I fixed the script (the print lines) (used decoder/encoder)…

Yes, straightforward to decode and fix but it was encoded for a reason.

Preferred that approach to generate logs to changing my system.