Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • T trappy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 19
    • Issues 19
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Tooling
  • trappy
  • Issues
  • #25
Closed
Open
Created Sep 15, 2015 by Javi Merino@JaviMerinoContributor

trappy should not rely on an internet connection being present

If you import trappy for the first time on a computer that's not connected to the internet it fails with:

<ipython-input-3-7a997815ef65> in <module>()
      2 import sys
      3 sys.path.append("..")
----> 4 import trappy
      5 
      6 map_label = {"00000000,00000006": "A57", "00000000,00000039": "A53"}

/tmp/trappy/trappy/__init__.pyc in <module>()
     17 from trappy.compare_runs import summary_plots, compare_runs
     18 from trappy.run import Run
---> 19 from trappy.plotter.LinePlot import LinePlot
     20 try:
     21     from trappy.plotter.ILinePlot import ILinePlot

/tmp/trappy/trappy/plotter/__init__.py in <module>()
     21 import AttrConf
     22 try:
---> 23     import trappy.plotter.EventPlot
     24 except ImportError:
     25     pass

/tmp/trappy/trappy/plotter/EventPlot.py in <module>()
     38 # pylint: disable=R0921
     39 # Initialize Resources
---> 40 IPythonConf.iplot_install("EventPlot")
     41 
     42 

/tmp/trappy/trappy/plotter/IPythonConf.pyc in iplot_install(module_name)
    113             os.mkdir(resource_dest_dir)
    114         resource_dest_path = os.path.join(resource_dest_dir, resource_name)
--> 115         install_resource(resource, resource_dest_path)
    116 
    117 

/tmp/trappy/trappy/plotter/IPythonConf.pyc in install_resource(from_path, to_path)
     86     if from_path.startswith("http"):
     87         if not os.path.isfile(to_path):
---> 88             install_http_resource(from_path, to_path)
     89     else:
     90         install_local_resource(from_path, to_path)

/tmp/trappy/trappy/plotter/IPythonConf.pyc in install_http_resource(url, to_path)
     56     :type to_path: str
     57     """
---> 58     urllib.urlretrieve(url, filename=to_path)
     59 
     60 

/usr/lib/python2.7/urllib.pyc in urlretrieve(url, filename, reporthook, data, context)
     96     else:
     97         opener = _urlopener
---> 98     return opener.retrieve(url, filename, reporthook, data)
     99 def urlcleanup():
    100     if _urlopener:

/usr/lib/python2.7/urllib.pyc in retrieve(self, url, filename, reporthook, data)
    243             except IOError:
    244                 pass
--> 245         fp = self.open(url, data)
    246         try:
    247             headers = fp.info()

/usr/lib/python2.7/urllib.pyc in open(self, fullurl, data)
    211         try:
    212             if data is None:
--> 213                 return getattr(self, name)(url)
    214             else:
    215                 return getattr(self, name)(url, data)

/usr/lib/python2.7/urllib.pyc in open_http(self, url, data)
    348         if realhost: h.putheader('Host', realhost)
    349         for args in self.addheaders: h.putheader(*args)
--> 350         h.endheaders(data)
    351         errcode, errmsg, headers = h.getreply()
    352         fp = h.getfile()

/usr/lib/python2.7/httplib.pyc in endheaders(self, message_body)
   1046         else:
   1047             raise CannotSendHeader()
-> 1048         self._send_output(message_body)
   1049 
   1050     def request(self, method, url, body=None, headers={}):

/usr/lib/python2.7/httplib.pyc in _send_output(self, message_body)
    890             msg += message_body
    891             message_body = None
--> 892         self.send(msg)
    893         if message_body is not None:
    894             #message_body was not a string (i.e. it is a file) and

/usr/lib/python2.7/httplib.pyc in send(self, data)
    852         if self.sock is None:
    853             if self.auto_open:
--> 854                 self.connect()
    855             else:
    856                 raise NotConnected()

/usr/lib/python2.7/httplib.pyc in connect(self)
    829         """Connect to the host and port specified in __init__."""
    830         self.sock = self._create_connection((self.host,self.port),
--> 831                                            self.timeout, self.source_address)
    832 
    833         if self._tunnel_host:

/usr/lib/python2.7/socket.pyc in create_connection(address, timeout, source_address)
    555     host, port = address
    556     err = None
--> 557     for res in getaddrinfo(host, port, 0, SOCK_STREAM):
    558         af, socktype, proto, canonname, sa = res
    559         sock = None

IOError: [Errno socket error] [Errno -2] Name or service not known

Importing trappy should not require an internet connection. We should only call IPythonConf.iplot_install() if it's actually needed.

Assignee
Assign to
Time tracking