4
$\begingroup$

I've installed the KnotTheory package, following the instructions here. But when I try to use it I get this error:

$CharacterEncoding: The byte sequence {139} could not be interpreted as a character in the UTF-8 character encoding.

Both << KnotTheory` and Needs["KnotTheory`"] raise this error (I found that byte sequence {139} is for "<"). "Needs" also raises

Needs: "Context KnotTheory` was not created when Needs was evaluated".

Parent directory of KnotTheory is in the $Path, but it doesn't help.

How can I fix it?

$\endgroup$
2
  • 1
    $\begingroup$ Assuming you are on a PC. If you put the folder "KnotTheory" in: "C:\ProgramData\Mathematica\Applications" and then load it using: "<< KnotTheory`" you willl get some warning messages about ParentDirectory and FileName. However, the package seems to work. $\endgroup$ Commented Aug 9, 2022 at 9:40
  • $\begingroup$ Have you seen my answer to <mathematica.stackexchange.com/questions/237034>? $\endgroup$
    – A. Kato
    Commented Aug 23, 2022 at 13:09

2 Answers 2

4
$\begingroup$

I recall that Claus Ernst once asked me about that. It's time that we make the fix public and searchable:

Go into the file init.m on the KnotTheory package directory. Then replace the lines

KnotTheoryDirectory[] = (
  File /. Flatten[FileInformation[ToFileName[#,"KnotTheory"]] & /@ ($Path /. "." -> Directory[])]
)

with

KnotTheoryDirectory[] = DirectoryName[$InputFileName];

Save the file, restart the kernel. Afterwards, the package should load just fine.

$\endgroup$
2
$\begingroup$

I just tried it. It works for me, it loads and I can call its functions, but I keep getting warning Get::path: ParentDirectory[File] in $Path is not a string. even though it does give the same output as on the web site.

I think you need to edit init.m to fix these. It seems like old package.

There are the steps I did

download zip file. Extract the folder KnotTheory. Then did

FileNameJoin[{$UserBaseDirectory,"Applications"}]

Which gives

"C:\\Users\\Owner\\AppData\\Roaming\\Mathematica\\Applications"

Then copied the folder KnotTheory to the above folder. So now it looks like this

enter image description here

Now from Mathematica

Quit[]

<< KnotTheory`

Gives these warnings

enter image description here

But it works

 Alexander[Knot[6, 2]][t]

Mathematica graphics

Mathematica graphics

I never used this package myself before. But the date on the webpage is 2013, which is old.

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.