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

import_network_from_file() fails if file name contains space followed by equal symbol #70

Open
coleslaw481 opened this issue Oct 15, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@coleslaw481
Copy link
Contributor

import_network_from_file() fails if the file name contains space followed by an equal symbol: hello =there.cx

This is on a Mac with big sur 11.6 and using py4cytoscape 0.0.11 with Python version 3.7.3

hello =there.cx.zip

To reproduce unzip the attached file, open a python terminal with current working directory set to directory with hello =there.cx file and run the following:

import os
import py4cytoscape as py4
py4.import_network_from_file(os.path.abspath('hello =there.cx'))

Error seen:

n commands_post(): Error processing arguments: String index out of range: 0
Traceback (most recent call last):
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/commands.py", line 390, in commands_post
    r.raise_for_status()
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:1234/v1/commands/network/load%20file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/py4cytoscape_logger.py", line 133, in wrapper_log
    log_exception(func, e)
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/py4cytoscape_logger.py", line 130, in wrapper_log
    value = func(*args, **kwargs) # Call function being logged
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/networks.py", line 1265, in import_network_from_file
    res = commands.commands_post(f'network load file file="{file}"', base_url=base_url)
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/py4cytoscape_logger.py", line 133, in wrapper_log
    log_exception(func, e)
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/py4cytoscape_logger.py", line 130, in wrapper_log
    value = func(*args, **kwargs) # Call function being logged
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/commands.py", line 396, in commands_post
    _handle_error(e)
  File "/Users/churas/anaconda3/envs/networkx2/lib/python3.7/site-packages/py4cytoscape/commands.py", line 682, in _handle_error
    raise e
py4cytoscape.exceptions.CyError: In commands_post(): Error processing arguments: String index out of range: 0
@coleslaw481 coleslaw481 added the bug Something isn't working label Oct 15, 2021
@bdemchak
Copy link
Collaborator

Thanks, Chris ... I have little doubt that this is a legit problem. Encoding is a funny thing, and it's a fair bit that I didn't get it all correct. I'll look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants