Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error opening local path with urllib2 #174

Closed
adieyal opened this issue Mar 20, 2014 · 0 comments
Closed

Error opening local path with urllib2 #174

adieyal opened this issue Mar 20, 2014 · 0 comments

Comments

@adieyal
Copy link

adieyal commented Mar 20, 2014

Running the helloworld example with python 2.7.4 I get this error:

$ slicer serve slicer.ini
Traceback (most recent call last):
File "/home/adi/.virtualenvs/cubes/bin/slicer", line 5, in
pkg_resources.run_script('cubes==1.0alpha', 'slicer')
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/pkg_resources.py", line 540, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/pkg_resources.py", line 1455, in run_script
execfile(script_filename, namespace, namespace)
File "/home/adi/.virtualenvs/cubes/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/EGG-INFO/scripts/slicer", line 466, in
args.func(args)
File "/home/adi/.virtualenvs/cubes/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/EGG-INFO/scripts/slicer", line 195, in run_server
cubes.server.run_server(config, debug=args.debug)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/server/base.py", line 43, in run_server
app = create_server(config)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/server/base.py", line 34, in create_server
app.register_blueprint(slicer, config=config)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/flask/app.py", line 62, in wrapper_func
return f(self, _args, *_kwargs)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/flask/app.py", line 889, in register_blueprint
blueprint.register(self, options, first_registration)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/flask/blueprints.py", line 153, in register
deferred(state)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/flask/blueprints.py", line 128, in wrapper
func(state)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/server/blueprint.py", line 88, in initialize_slicer
current_app.cubes_workspace = Workspace(config)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/workspace.py", line 434, in init
self.import_model(path)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/workspace.py", line 553, in import_model
metadata = read_model_metadata(path)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/metadata.py", line 89, in read_model_metadata
return read_model_metadata_bundle(source)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/metadata.py", line 117, in read_model_metadata_bundle
model = _json_from_url(info_path)
File "/home/adi/.virtualenvs/cubes/local/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/metadata.py", line 68, in _json_from_url
handle = urllib2.urlopen(url)
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 396, in open
protocol = req.get_type()
File "/usr/lib/python2.7/urllib2.py", line 258, in get_type
raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: /home/adi/.virtualenvs/cubes/lib/python2.7/site-packages/cubes-1.0alpha-py2.7.egg/cubes/models/base.cubesmodel/model.json

It seems to be because you are using a file path in urllib2 without "file://". Urllib seem to handle it just fine. Not sure if urllib2 functionality has changed in python 3.

@Stiivi Stiivi closed this as completed in c5d995e Mar 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant