Hari
Hari

Reputation: 1

@Python - NameError: global name 'select' is not defined

I used import select before calling the function that has select.

I used select as shown below:

rl, wl, xl = select.select([stdout.channel], [], [], 0.0)

Here stdout.channel is something I am reading from an SSH connection through paramiko.

Stack Trace:

File "C:\Code\Test.py", line 84, in Test

rl, wl, xl = select.select([stdout.channel], [], [], 0.0)
NameError: global name 'select' is not defined

Upvotes: 0

Views: 9379

Answers (1)

Hari
Hari

Reputation: 1

Observations:

  1. When running the python script from command line - works well. No such errors are brought up.

  2. When running the same script using ECLIPSE, I see an error as stated above.

Solution:

I imported select by using:

import select as something

Now when I use it in my script, the error is gone.

rl, wl, xl = something.select([stdout.channel], [], [], 0.0)

Upvotes: 0

Related Questions