Forums

Try to run a Textparser

Hi!

I do try to run a textparser python script (its an email content generator actually) that somebody wrote for me but I can not get it to run.

It runs perfectly locally on my Mac with Python 2.7.5 I have uploaded all files at the cloud and I tried various attempts but not even one suceeded. Can somebody here take me by the hand and lead me through the streets of pythonanywhere to get it to run? I am a newbie here and in python either.

Thanks much!

What error message(s) do you get when you run it?

bash: guinewsreader.py: command not found Console closed.

How are you trying to run it?

You should try a Scheduled Task. Dashboard>>schedule

  1. Put the file in a folder somewhere like /home/newspool/scripts
  2. In the scheduled task enter the location of your script /home/newspool/scripts/guinewsreader.py
  3. Set the time a minute after the current time to test if it does work.
  4. You can click on the "view log" link to see if its executed and/or if it displays any errors

Well, actually I do not know how to run it. Tried to call the file.py in a console and also tried to call http://myusername.pythonanywhere.com/script.py - with this I get page not found

@leapfrog content of https://www.pythonanywhere.com/user/newspool/files/var/log/tasklog-21683-daily-at-2004-_.home.newspool.guinewsreader.py.log

bash: /home/newspool/guinewsreader.py: Permission denied 2015-11-25 20:04:06 -- Completed task, took 0.00 seconds, return code was 126.

add a "python" or "python3.4" to the beginning of the scheduled task command? eg

python /home/newspool/scripts/guinewsreader.py

instead of just home/newspool/scripts/guinewsreader.py

ok, this is what I got in the log fle:

--snip--

  Traceback (most recent call last):
      File "/home/newspool/guinewsreader.py", line 103, in <module>
        main()
      File "/home/newspool/guinewsreader.py", line 85, in main
        root = tk.Tk()
      File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __init__
        self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
    _tkinter.TclError: no display name and no $DISPLAY environment variable

    2015-11-26 11:01:24 -- Completed task, took 6.00 seconds, return code was 1.

--snap--

Ah, that looks like you're trying to run an app with a graphical user interface. PythonAnywhere is a text-only server-based environment, so that won't work, unfortunately.

it is just a popup window that grabs and shows some collected text content. I do copy the text output in my mail, which is what the program should do.

I also have a non-gui version of this program but i would need to change the output method. it could also be email or some other means but I would need somebody here to help me with this. Is there anyone who is willing to help? I would also pay a little ...

That's not something we (PythonAnywhere staff) can do, but perhaps there are other people in the forums who might be able to help...?

Alternatively, CodeMentor offer live one-to-one Python coaching, which might be a good option. They're a separate company to us, and they match you up with independent Python developers.