1

I've just installed the package tftpy version 0.6.2 when I import it I get a syntax error with the line: running the code:

import tftpy

I get the error: raise ImportError, "Requires at least Python 2.3"

SyntaxError: Invalid syntax

I have version 3.6.3 installed.

import sys
print(sys.version_info)

gives me the out put major=3, minor=6, micro=3.

However the line of code that raises the syntax error is the last line in the code below:

import sys
required_version = (2, 3)
if sys.version_info < required_version:
    raise ImportError, "Requires at least Python 2.3"

I don't think the issue is with my version number I think it doesn't like the syntax used to raise the ImportError exception. Any help would be greatly received.

Rob
  • 151
  • 1
  • 2
  • 11
  • 1
    Maybe this can help you, i was seeing the issues and PR of `tftpy` on github, and appears that something it's been done. [Follow the link.](https://github.com/internap/fake-switches/pull/79) – Abe Mar 05 '18 at 14:56
  • Thanks it seems like the fix is to change the lines of code which throw the exceptions from: raise ExceprionName, "Exception Message" to raise ExceptionName("Exception Message") – Rob Mar 05 '18 at 15:04

1 Answers1

0

I found the error in my case. When you run a tftpy server, you need to run it as sudo, therefor you need to install tftpy as sudo also.

In my case:

$ sudo pip3 install tftpy
$ sudo python3 tftpy-program.py

Also remember that if you use python3, f.eks, you need to install the package with pip3, and not jsut pip. Hope it helps.

Elias Fyksen
  • 879
  • 9
  • 12