IOError: [Errno 22] Invalid argument with url
up vote
0
down vote
favorite
I am newbie in python and i am trying to open an localhost with write mode
but i got following errors
with io.open('http:\localhost:3000\assets\i18n\locale-ru.json', 'w') as outfile:
IOError: [Errno 22] Invalid argument: 'http:\localhost:3000\assets\i18n\locale-ru.json'
Here is a piece of code:
with io.open('http://localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile:
str_ = json.dumps(data_ru,
indent=4, sort_keys=True,
separators=(',', ': '), ensure_ascii=False)
outfile.write(to_unicode(str_))
python flask
add a comment |
up vote
0
down vote
favorite
I am newbie in python and i am trying to open an localhost with write mode
but i got following errors
with io.open('http:\localhost:3000\assets\i18n\locale-ru.json', 'w') as outfile:
IOError: [Errno 22] Invalid argument: 'http:\localhost:3000\assets\i18n\locale-ru.json'
Here is a piece of code:
with io.open('http://localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile:
str_ = json.dumps(data_ru,
indent=4, sort_keys=True,
separators=(',', ': '), ensure_ascii=False)
outfile.write(to_unicode(str_))
python flask
1
Just a note, you have only one slash after `http:`.
– vishes_shell
Nov 12 at 19:42
with io.open('http:/localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile: IOError: [Errno 22] Invalid argument: 'http:/localhost:3000//assets//i18n//locale-ru.json'
– user987
Nov 12 at 19:46
still got error
– user987
Nov 12 at 19:47
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am newbie in python and i am trying to open an localhost with write mode
but i got following errors
with io.open('http:\localhost:3000\assets\i18n\locale-ru.json', 'w') as outfile:
IOError: [Errno 22] Invalid argument: 'http:\localhost:3000\assets\i18n\locale-ru.json'
Here is a piece of code:
with io.open('http://localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile:
str_ = json.dumps(data_ru,
indent=4, sort_keys=True,
separators=(',', ': '), ensure_ascii=False)
outfile.write(to_unicode(str_))
python flask
I am newbie in python and i am trying to open an localhost with write mode
but i got following errors
with io.open('http:\localhost:3000\assets\i18n\locale-ru.json', 'w') as outfile:
IOError: [Errno 22] Invalid argument: 'http:\localhost:3000\assets\i18n\locale-ru.json'
Here is a piece of code:
with io.open('http://localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile:
str_ = json.dumps(data_ru,
indent=4, sort_keys=True,
separators=(',', ': '), ensure_ascii=False)
outfile.write(to_unicode(str_))
python flask
python flask
edited Nov 12 at 20:04
vencaslac
1,010217
1,010217
asked Nov 12 at 19:40
user987
11
11
1
Just a note, you have only one slash after `http:`.
– vishes_shell
Nov 12 at 19:42
with io.open('http:/localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile: IOError: [Errno 22] Invalid argument: 'http:/localhost:3000//assets//i18n//locale-ru.json'
– user987
Nov 12 at 19:46
still got error
– user987
Nov 12 at 19:47
add a comment |
1
Just a note, you have only one slash after `http:`.
– vishes_shell
Nov 12 at 19:42
with io.open('http:/localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile: IOError: [Errno 22] Invalid argument: 'http:/localhost:3000//assets//i18n//locale-ru.json'
– user987
Nov 12 at 19:46
still got error
– user987
Nov 12 at 19:47
1
1
Just a note, you have only one slash after `http:`.
– vishes_shell
Nov 12 at 19:42
Just a note, you have only one slash after `http:`.
– vishes_shell
Nov 12 at 19:42
with io.open('http:/localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile: IOError: [Errno 22] Invalid argument: 'http:/localhost:3000//assets//i18n//locale-ru.json'
– user987
Nov 12 at 19:46
with io.open('http:/localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile: IOError: [Errno 22] Invalid argument: 'http:/localhost:3000//assets//i18n//locale-ru.json'
– user987
Nov 12 at 19:46
still got error
– user987
Nov 12 at 19:47
still got error
– user987
Nov 12 at 19:47
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
According to the doc, the io.open
function only reads a local file given a file path. Considering you're trying to read from a http url, I guess a better tools might be requests
getting struggle with reguests documentation, i would really appreciate if you send me with source code
– user987
Nov 12 at 20:10
what about urllib.urlopen in Python 2.7
– user987
Nov 13 at 11:24
` with urllib.urlopen('localhost:3000//assets/i18n//locale-kg.json', 'w') as outfile: str_ = json.dumps(data_kg, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False) outfile.write(to_unicode(str_))`
– user987
Nov 13 at 11:25
As far as I know, to update a file via HTTP you have to send a POST or a PUT request with a file on your local, just like you upload a file to some website. So if I wanted to update a file via an URL, I would firstly download it to my local, then do changes on it, and finally upload the file back. As for file uploading, you could refer stackoverflow.com/a/26791188/2191173 for details.
– Old Panda
Nov 13 at 18:26
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
According to the doc, the io.open
function only reads a local file given a file path. Considering you're trying to read from a http url, I guess a better tools might be requests
getting struggle with reguests documentation, i would really appreciate if you send me with source code
– user987
Nov 12 at 20:10
what about urllib.urlopen in Python 2.7
– user987
Nov 13 at 11:24
` with urllib.urlopen('localhost:3000//assets/i18n//locale-kg.json', 'w') as outfile: str_ = json.dumps(data_kg, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False) outfile.write(to_unicode(str_))`
– user987
Nov 13 at 11:25
As far as I know, to update a file via HTTP you have to send a POST or a PUT request with a file on your local, just like you upload a file to some website. So if I wanted to update a file via an URL, I would firstly download it to my local, then do changes on it, and finally upload the file back. As for file uploading, you could refer stackoverflow.com/a/26791188/2191173 for details.
– Old Panda
Nov 13 at 18:26
add a comment |
up vote
0
down vote
According to the doc, the io.open
function only reads a local file given a file path. Considering you're trying to read from a http url, I guess a better tools might be requests
getting struggle with reguests documentation, i would really appreciate if you send me with source code
– user987
Nov 12 at 20:10
what about urllib.urlopen in Python 2.7
– user987
Nov 13 at 11:24
` with urllib.urlopen('localhost:3000//assets/i18n//locale-kg.json', 'w') as outfile: str_ = json.dumps(data_kg, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False) outfile.write(to_unicode(str_))`
– user987
Nov 13 at 11:25
As far as I know, to update a file via HTTP you have to send a POST or a PUT request with a file on your local, just like you upload a file to some website. So if I wanted to update a file via an URL, I would firstly download it to my local, then do changes on it, and finally upload the file back. As for file uploading, you could refer stackoverflow.com/a/26791188/2191173 for details.
– Old Panda
Nov 13 at 18:26
add a comment |
up vote
0
down vote
up vote
0
down vote
According to the doc, the io.open
function only reads a local file given a file path. Considering you're trying to read from a http url, I guess a better tools might be requests
According to the doc, the io.open
function only reads a local file given a file path. Considering you're trying to read from a http url, I guess a better tools might be requests
answered Nov 12 at 19:44
Old Panda
570621
570621
getting struggle with reguests documentation, i would really appreciate if you send me with source code
– user987
Nov 12 at 20:10
what about urllib.urlopen in Python 2.7
– user987
Nov 13 at 11:24
` with urllib.urlopen('localhost:3000//assets/i18n//locale-kg.json', 'w') as outfile: str_ = json.dumps(data_kg, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False) outfile.write(to_unicode(str_))`
– user987
Nov 13 at 11:25
As far as I know, to update a file via HTTP you have to send a POST or a PUT request with a file on your local, just like you upload a file to some website. So if I wanted to update a file via an URL, I would firstly download it to my local, then do changes on it, and finally upload the file back. As for file uploading, you could refer stackoverflow.com/a/26791188/2191173 for details.
– Old Panda
Nov 13 at 18:26
add a comment |
getting struggle with reguests documentation, i would really appreciate if you send me with source code
– user987
Nov 12 at 20:10
what about urllib.urlopen in Python 2.7
– user987
Nov 13 at 11:24
` with urllib.urlopen('localhost:3000//assets/i18n//locale-kg.json', 'w') as outfile: str_ = json.dumps(data_kg, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False) outfile.write(to_unicode(str_))`
– user987
Nov 13 at 11:25
As far as I know, to update a file via HTTP you have to send a POST or a PUT request with a file on your local, just like you upload a file to some website. So if I wanted to update a file via an URL, I would firstly download it to my local, then do changes on it, and finally upload the file back. As for file uploading, you could refer stackoverflow.com/a/26791188/2191173 for details.
– Old Panda
Nov 13 at 18:26
getting struggle with reguests documentation, i would really appreciate if you send me with source code
– user987
Nov 12 at 20:10
getting struggle with reguests documentation, i would really appreciate if you send me with source code
– user987
Nov 12 at 20:10
what about urllib.urlopen in Python 2.7
– user987
Nov 13 at 11:24
what about urllib.urlopen in Python 2.7
– user987
Nov 13 at 11:24
` with urllib.urlopen('localhost:3000//assets/i18n//locale-kg.json', 'w') as outfile: str_ = json.dumps(data_kg, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False) outfile.write(to_unicode(str_))`
– user987
Nov 13 at 11:25
` with urllib.urlopen('localhost:3000//assets/i18n//locale-kg.json', 'w') as outfile: str_ = json.dumps(data_kg, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False) outfile.write(to_unicode(str_))`
– user987
Nov 13 at 11:25
As far as I know, to update a file via HTTP you have to send a POST or a PUT request with a file on your local, just like you upload a file to some website. So if I wanted to update a file via an URL, I would firstly download it to my local, then do changes on it, and finally upload the file back. As for file uploading, you could refer stackoverflow.com/a/26791188/2191173 for details.
– Old Panda
Nov 13 at 18:26
As far as I know, to update a file via HTTP you have to send a POST or a PUT request with a file on your local, just like you upload a file to some website. So if I wanted to update a file via an URL, I would firstly download it to my local, then do changes on it, and finally upload the file back. As for file uploading, you could refer stackoverflow.com/a/26791188/2191173 for details.
– Old Panda
Nov 13 at 18:26
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269003%2fioerror-errno-22-invalid-argument-with-url%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Just a note, you have only one slash after `http:`.
– vishes_shell
Nov 12 at 19:42
with io.open('http:/localhost:3000//assets//i18n//locale-ru.json', 'w') as outfile: IOError: [Errno 22] Invalid argument: 'http:/localhost:3000//assets//i18n//locale-ru.json'
– user987
Nov 12 at 19:46
still got error
– user987
Nov 12 at 19:47