IOError: [Errno 22] Invalid argument with url












0














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_))









share|improve this question




















  • 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
















0














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_))









share|improve this question




















  • 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














0












0








0







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_))









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 20:04









vencaslac

1,002217




1,002217










asked Nov 12 at 19:40









user987

12




12








  • 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




    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












1 Answer
1






active

oldest

votes


















0














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






share|improve this answer





















  • 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











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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






share|improve this answer





















  • 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
















0














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






share|improve this answer





















  • 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














0












0








0






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






share|improve this answer












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







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 19:44









Old Panda

574621




574621












  • 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










  • 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


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Bressuire

Vorschmack

Quarantine