Skip to content Skip to sidebar Skip to footer

Howto Ignore Specific Undefined Variables In Pydev Eclipse

I'm writing a crossplatform python script on windows using Eclipse with the Pydev plugin. The script makes use of the os.symlink() and os.readlink() methods if the current platform

Solution 1:

I use pydev + pylint.

With pylint you can add which messages to ignore in the Preferences>Pydev>Pylint>"Aggruments to pass to pylint" section.

--disable-msg=W0232,F0401

You can ignore messages in-line as well with comments:

os.symlink(target, symlink) # IGNORE:<MessageID> 

Mouse-over the "x" where the line numbers are to see the message id.

Solution 2:

I suspect pydev may have better, specific solutions, but what about just putting some code at the start of your program, such as:

ifnot hasattr(os, 'symlink'): os.symlink = None

Yeah, it's a hack, but, unless pydev does have specialized solutions (unfortunately I don't know of any, but then I'm no pydev expert;-), may be better than nothing...

Solution 3:

I noticed PyDev doesn't recognize ZeroMQ constants so I struggled with the same problem.

I found PyDev has a settings option in Preferences > PyDev > Code Editor > Code Analysis : Undefined-tab. Just write symlink and readlink there (comma separated) to remove the errors.

Still not optimal, but good enough for now.

Post a Comment for "Howto Ignore Specific Undefined Variables In Pydev Eclipse"