{"action":"closed","issue":{"url":"https://api.github.com/repos/pantsbuild/pants/issues/1802","labels_url":"https://api.github.com/repos/pantsbuild/pants/issues/1802/labels{/name}","comments_url":"https://api.github.com/repos/pantsbuild/pants/issues/1802/comments","events_url":"https://api.github.com/repos/pantsbuild/pants/issues/1802/events","html_url":"https://github.com/pantsbuild/pants/issues/1802","id":94773684,"number":1802,"title":"How to resolve \"Failed to eval target\"?","user":{"login":"tejal29","id":1534539,"avatar_url":"https://avatars.githubusercontent.com/u/1534539?v=3","gravatar_id":"","url":"https://api.github.com/users/tejal29","html_url":"https://github.com/tejal29","followers_url":"https://api.github.com/users/tejal29/followers","following_url":"https://api.github.com/users/tejal29/following{/other_user}","gists_url":"https://api.github.com/users/tejal29/gists{/gist_id}","starred_url":"https://api.github.com/users/tejal29/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejal29/subscriptions","organizations_url":"https://api.github.com/users/tejal29/orgs","repos_url":"https://api.github.com/users/tejal29/repos","events_url":"https://api.github.com/users/tejal29/events{/privacy}","received_events_url":"https://api.github.com/users/tejal29/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pantsbuild/pants/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-13T17:45:51Z","updated_at":"2015-07-14T03:49:24Z","closed_at":"2015-07-14T03:49:24Z","body":"I am working on adding npm_module tasks in contrib folder.\r\n\r\nI am seeing this error. I spent 3 hours yesterday debugging this, but havnt reached anywhere. Does this sound familiar  to anyone?\r\nI am running, \r\n\r\nPEX_VERBOSE=5 PANTS_DEV=1 ./pants compile contrib/npm_module/src/python/pants/contrib/npm_module/targets\r\n\r\n```\r\n10:43:40 00:01       [eval-targets].\r\n                         Failed to eval contrib/npm_module/src/python/pants/contrib/npm_module/targets:targetsTraceback (most recent call last):\r\n                           File \"/private/var/folders/t_/ck6c3zvj2z5cg77dqx2kh8tr0000gp/T/tmpSL8IIc/.bootstrap/_pex/pex.py\", line 319, in execute\r\n                             self._wrap_coverage(self._wrap_profiling, self._execute)\r\n                           File \"/private/var/folders/t_/ck6c3zvj2z5cg77dqx2kh8tr0000gp/T/tmpSL8IIc/.bootstrap/_pex/pex.py\", line 254, in _wrap_coverage\r\n                             runner(*args)\r\n                           File \"/private/var/folders/t_/ck6c3zvj2z5cg77dqx2kh8tr0000gp/T/tmpSL8IIc/.bootstrap/_pex/pex.py\", line 286, in _wrap_profiling\r\n                             runner(*args)\r\n                           File \"/private/var/folders/t_/ck6c3zvj2z5cg77dqx2kh8tr0000gp/T/tmpSL8IIc/.bootstrap/_pex/pex.py\", line 362, in _execute\r\n                             return self.execute_entry(self._pex_info.entry_point)\r\n                           File \"/private/var/folders/t_/ck6c3zvj2z5cg77dqx2kh8tr0000gp/T/tmpSL8IIc/.bootstrap/_pex/pex.py\", line 420, in execute_entry\r\n                             runner(entry_point)\r\n                           File \"/private/var/folders/t_/ck6c3zvj2z5cg77dqx2kh8tr0000gp/T/tmpSL8IIc/.bootstrap/_pex/pex.py\", line 425, in execute_module\r\n                             runpy.run_module(module_name, run_name='__main__')\r\n                           File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py\", line 170, in run_module\r\n                             mod_name, loader, code, fname = _get_module_details(mod_name)\r\n                           File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py\", line 113, in _get_module_details\r\n                             code = loader.get_code(mod_name)\r\n                           File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py\", line 284, in get_code\r\n                             self.code = compile(source, self.filename, 'exec')\r\n                           File \"/private/var/folders/t_/ck6c3zvj2z5cg77dqx2kh8tr0000gp/T/tmpSL8IIc/__pants_executable__.py\", line 35\r\n                             import \r\n                                   ^\r\n                         SyntaxError: invalid syntax\r\n                         \r\n                         \r\n                         import os\r\n                         import sys\r\n                         \r\n                         __entry_point__ = None\r\n                         if '__file__' in locals() and __file__ is not None:\r\n                           __entry_point__ = os.path.dirname(__file__)\r\n                         elif '__loader__' in locals():\r\n                           from zipimport import zipimporter\r\n                           from pkgutil import ImpLoader\r\n                           if hasattr(__loader__, 'archive'):\r\n                             __entry_point__ = __loader__.archive\r\n                           elif isinstance(__loader__, ImpLoader):\r\n                             __entry_point__ = os.path.dirname(__loader__.get_filename())\r\n                         \r\n                         if __entry_point__ is None:\r\n                           sys.stderr.write('Could not launch python executable!\\n')\r\n                           sys.exit(2)\r\n                         \r\n                         sys.path[0] = os.path.abspath(sys.path[0])\r\n                         sys.path.insert(0, os.path.abspath(os.path.join(__entry_point__, '.bootstrap')))\r\n                         \r\n                         from _pex.pex_bootstrapper import bootstrap_pex\r\n                         bootstrap_pex(__entry_point__)\r\n                         \r\n                         from __future__ import print_function\r\n                         \r\n                         import inspect\r\n                         import os\r\n                         import sys\r\n                         import traceback\r\n                         \r\n                         \r\n                         def backtrace_to_here():\r\n                           trace = inspect.trace(context=1)\r\n                           trace.pop(0)  # discard this helper function frame\r\n                         \r\n                           pre_processed = []\r\n                           for info in trace:\r\n                             frame = info[0]\r\n                             tb = inspect.getframeinfo(frame)\r\n                             filename = tb.filename\r\n                             if filename.startswith('/Users/tdesai/projects/pants/.pants.d/python-setup/chroots'):\r\n                               relpath_parent = os.path.relpath(filename, '/Users/tdesai/projects/pants/.pants.d/python-setup/chroots')\r\n                               relpath = relpath_parent.split(os.sep, 1)[1]\r\n                               filename = os.path.join('[srcroot]', relpath)\r\n                             line_text = tb.code_context[tb.index]\r\n                             pre_processed.append((filename, tb.lineno, tb.function, line_text))\r\n                         \r\n                           return ''.join(traceback.format_list(pre_processed)).rstrip()\r\n                         \r\n                         \r\n                         def log(message=''):\r\n                           print(message, file=sys.stderr)\r\n                         \r\n                         \r\n                         if __name__ == '__main__':\r\n                           # TODO(John Sirois): Consider collecting all import errors before exiting non-zero.\r\n                           try:\r\n                             import \r\n                           except ImportError as e:\r\n                             log()\r\n                             log(\"Failed to eval 'file contrib/npm_module/src/python/pants/contrib/npm_module/targets/__init__.py':\")\r\n                             log(backtrace_to_here())\r\n                             log(str(e))\r\n                             sys.exit(1)\r\n                         \r\n                           try:\r\n                             import gen_resources\r\n                           except ImportError as e:\r\n                             log()\r\n                             log(\"Failed to eval 'file contrib/npm_module/src/python/pants/contrib/npm_module/targets/gen_resources.py':\")\r\n                             log(backtrace_to_here())\r\n                             log(str(e))\r\n                             sys.exit(1)\r\n                         \r\n                           sys.exit(0)\r\n                         \r\n                         \r\nFAILURE: Failed to eval contrib/npm_module/src/python/pants/contrib/npm_module/targets:targets\r\n\r\n\r\n               Waiting for background workers to finish.\r\n10:43:41 00:02   [complete]\r\n               FAILURE\r\nYou have new mail in /var/mail/tdesai\r\n\r\n```\r\n\r\nI have added the newly added backed on paths to pants.ini\r\n```\r\ndiff --git a/pants.ini b/pants.ini\r\nindex 51aa086..dc5c31e 100644\r\n--- a/pants.ini\r\n+++ b/pants.ini\r\n@@ -14,6 +14,7 @@ print_exception_stacktrace: True\r\n # Enable our own custom loose-source plugins as well as contribs.\r\n pythonpath: [\r\n     \"%(buildroot)s/pants-plugins/src/python\",\r\n+    \"%(buildroot)s/contrib/npm_module/src/python\",\r\n     \"%(buildroot)s/contrib/scrooge/src/python\",\r\n     \"%(buildroot)s/contrib/spindle/src/python\",\r\n     \"%(buildroot)s/contrib/cpp/src/python\",\r\n@@ -26,6 +27,7 @@ backend_packages: [\r\n     \"internal_backend.utilities\",\r\n     \"pants.backend.android\",\r\n     \"pants.contrib.cpp\",\r\n+    \"pants.contrib.npm_module\",\r\n     \"pants.contrib.scrooge\",\r\n     \"pants.contrib.spindle\",\r\n   ]\r\n```"}}