Python implementation: urllib broken?

Started by ahoerl, December 02, 2015, 09:18:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ahoerl

Good morning from Austria!

I am trying to use the (attached) Python File to retrieve the materials for our 3D-objects from our internal database.
If I use "python.exe" the file works as expected.

If I try to run those lines from Keyshot Script runner I get an error which complains about missing import modules in urllib.

The error from script runner is:

Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "C:\Program Files\KeyShot6\bin\py-dist\urllib\request.py", line 85, in <module>
    import bisect
ImportError: No module named 'bisect'

We have bought Keyshot yesterday, so my version of Keyshot 6 Pro should be recent.

Thanks for your help!

Andreas Hörl
Prolicht GmbH - Architectural Ligthing

Morten Kristensen

#1
Good morning, Andreas.

The bisect module was trimmed away because it was thought not needed but I will add it back in a future update/release. Thanks for noticing.

I took a look at your code and you can actually refrain from using the os, io, and urllib modules. You only need urllib.request and json.

However, to solve it you can enable detecting a locally installed python 3.4 64-bit by going to "preferences", "advanced" and ticking the "Use local Python paths .." checkbox. Then save and restart KeyShot. To make sure it finds it install python to C:\Python or C:\Python34 (I saw you were on Windows).

ahoerl

Thank you Morten!

I will try to enable my local python instance.
JSON would improve the way I can use data from our existing systems/databases.

Thank you for the quick reply!

Andreas Hörl
Prolicht Gmbh - Architectural lighting

ahoerl

Good evening!

Just tried to use the local python instance (again). It just does not work - I always get

Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "C:\Program Files\KeyShot6\bin\py-dist\urllib\request.py", line 85, in <module>
    import bisect
ImportError: No module named 'bisect'

It works from command line, python is in C:\Python34 (and now in C:\Python)
I have started Keyshot as Admin (same result)
If I start the command prompt as admin: no problem on the command line

python.exe (3.4) is in my System-Path (works)
I have set an additional "PYTHONPATH" --> C:\Python34

Still no luck :(
Unfortunately I need it now (it has been "I want it" for the last few weeks.