Python Forum
OSError: [Errno 22] Invalid argument - wasn't there last time I ran the code!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OSError: [Errno 22] Invalid argument - wasn't there last time I ran the code!
#1
Hi - I'm going to preface this by saying that I have VERY little coding experience, and am cobbling a topic modeling program for a paper I'm writing. I successfully ran the code last week, with no errors. I tried to run it again today and I'm getting the following:


file_content = open("nippur-input.txt").read()
tokens = nltk.word_tokenize(file_content)
print (tokens)
OSError Traceback (most recent call last)
<ipython-input-2-5dd1937bcad9> in <module>()
1 #tokenize
----> 2 file_content = open("nippur-input.txt").read()
3 tokens = nltk.word_tokenize(file_content)
4 print (tokens)

OSError: [Errno 22] Invalid argument

Any ideas on how I should fix this?
If I remove the "" I get :
NameError: name 'nippur' is not defined

I'm sorry if I'm not providing enough information!

ETA: I run a macOS, and I use python through a jupyter notebook, if that is relevant.
Reply
#2
Ok,

you are not showing enough code
do you have import nltk ?
There must be more than these three lines.
It is always helpful, (and requested) that snippets of code be complete enough to run.
Quote:ETA: I run a macOS, and I use python through a jupyter notebook, if that is relevant.
possibly, since in jupyter the last time you ran, you may have executed portions of code that you missed this time.
Try clicking the >| run button which will execute all code in sequence.
Reply
#3
Thank you - I went back and checked the input file and it had corrupted. I switched it out and it's working now.
I will post all of the code next time, thank you!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  OSError occurs in Linux. anna17 2 185 Mar-23-2024, 10:00 PM
Last Post: snippsat
  Invalid argument: 'images\x08ackground.jpg' CatBall 4 904 Jun-19-2023, 09:28 AM
Last Post: CatBall
  OSError with SMPT script Milan 0 692 Apr-28-2023, 01:34 PM
Last Post: Milan
  OSERROR When mkdir Oshadha 4 1,659 Jun-29-2022, 08:50 AM
Last Post: DeaD_EyE
  [split] [Errno 22] Invalid argument Junaid 0 2,253 Jun-12-2021, 06:02 PM
Last Post: Junaid
  OSError: Unable to load libjvm when connecting to hdfs with pyarrow 3.0.0 aupres 0 3,098 Mar-22-2021, 10:25 AM
Last Post: aupres
  Assistance with running a few lines of code at an EXACT time nethatar 5 3,165 Feb-24-2021, 10:43 PM
Last Post: nilamo
  Stumped by my own code (ratio & epoch-time calculation). MvGulik 2 2,089 Dec-30-2020, 12:04 AM
Last Post: MvGulik
  Code taking too much time to process ErPipex 11 4,818 Nov-16-2020, 09:42 AM
Last Post: DeaD_EyE
  What is the run time complexity of this code and please explain? samlee916 2 2,257 Nov-06-2020, 02:37 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020