Help Any Python or Ruby people here? Files won't run

Discussion in 'computers, web and general tech' started by scifisam, Apr 4, 2018.

  1. scifisam

    scifisam feck! arse! girls! drink!

    I'm trying to play around with Ruby and/or Python because my daughter needs to create a bot for her project and her computer's screwed. However, the test files I've created won't open. They do that thing where they flash on screen for half a second and disappear before you can read what they say.

    In Ruby, all I've written is:

    puts 'jello world'

    I tried changing the ' to " and it's no better.

    The files are saved in a subfolder called lib in a folder called TumblrBot, according to the instructions on here. https://vaporsoft.net/creating-a-tumblr-bot-from-scratch/

    I'm on Windows 10.

    Can anyone help please?
     
    Pickman's model likes this.
  2. 2hats

    2hats

    When I have problems coding in Python I typically use the interactive runtime shell ipython to help understand and solve them.

    I don’t speak Ruby but a quick search suggests maybe irb or pry might offer similar in that ecosystem (ie try running your example code in those environments).

    Sorry to not be of much more help, but perhaps a Ruby native will be along shortly to offer better ideas.
     
  3. alan_

    alan_ Well-Known Member

    I have not used python extensively,but from other languages I would try putting system (Pause)(or the Python equivalent) or time.sleep(secs) to stop the final execution and let you have a look at what is happening
     
  4. Crispy

    Crispy The following psytrance is baṉned: All

    Are you running them from Explorer, or the command line?
     
    Fez909 likes this.
  5. scifisam

    scifisam feck! arse! girls! drink!

    Weirdly, my test files in Python did have pause in them already, but that hasn't helped.

    I'm running them from the command line. I'm trying something different now and the command line is just refusing to admit the files exist :confused:

    I'm following the instructions on here: https://vaporsoft.net/creating-a-tumblr-bot-from-scratch/

    Sorry if I'm a but terse btw - tired and lots of pain and difficulty typing.
     
  6. scifisam

    scifisam feck! arse! girls! drink!

    I think part of the problem is that I don't understand this line:

    Create a few new folders in your project directory. They will be titled bin and lib. Also, create a new file called Gemfile in your project root.

    Well, I thought I'd done this, but is the project directory something special? I thought it would just be where I'd decided to store this stuff. And what's the project root? Isn't this the project directory?

    upload_2018-4-4_17-42-27.png

    I've tried moving stuff to different places on the computer and fiddling with the commands.
     
  7. alan_

    alan_ Well-Known Member

    It doesn't matter where those files are as long as the execution can find them that is what you set the paths to do Check your paths again
     
  8. scifisam

    scifisam feck! arse! girls! drink!

    I did check the box saying to add ruby to the path thing when I installed it.

    The problem might be that I'm on Windows and the instructions given aren't for Windows. But I don't know how to translate them to Windows :(
     
  9. alan_

    alan_ Well-Known Member

    That's why pausing it sometimes gets a message on the shell "no lib" or "no bin" then you know it cannot find it. Somewhere in the settings there is access to a pathway settings and this is where the programme will look for the lib and bin files. You need to find that setting and point the pathway to where they are. If this is your only problem its very fixable and when you have done it once you know for future.
     
  10. scifisam

    scifisam feck! arse! girls! drink!

    But the pause is already in the file (for the Python file) and there's no message saying no lib or no bin. There's nothing at all. :(

    I've uninstalled Ruby and installed it again in case I missed something.
     
  11. alan_

    alan_ Well-Known Member

    Oh and syntax when pointing to paths are usually very specific
     
  12. alan_

    alan_ Well-Known Member

    No we have gone past pause now and are assuming that it is indeed a pathway error
     
  13. scifisam

    scifisam feck! arse! girls! drink!

    You mean the specific words and punctuation used? I thought so, which is why I copied and pasted from the instructions rather than typing them in, but now it seems those instructions aren't actually valid for Windows.
     
  14. alan_

    alan_ Well-Known Member

    From your example above your paths will be something along the lines

    ThisPC/AcerC/tumbler_bot/lib
    ThisPC/AcerC/tumbler_bot/bin
    Depending on where they are being sought from, you might need a extra level up or down to complete the path ie //C/ my computer or whatever.
    The slashes forward or back and their number also need to be very specific
     
  15. xenon

    xenon Sacred moche hat combat

    What if you bring up a command prompt.
    Cd to the directory where the files are.
    Then run.
    python my_filename

    I don't know Ruby but should be similar.
     
  16. xenon

    xenon Sacred moche hat combat

    Oh yeah. Windows replace / for \. So it would be something like
    C:\users\My username\my docs\python\my_filename
     
  17. scifisam

    scifisam feck! arse! girls! drink!

    Thanks! I thought that could be the problem but now it's saying ruby doesn't exist. Sigh.
     
  18. scifisam

    scifisam feck! arse! girls! drink!

    I thought I'd solved the problem after repeatedly uninstalling and reinstalling, because then when I went to cd and typed in ruby -v it acknowledged I had Ruby installed and told me which version it was.

    Tried to get it to acknowledge any of the test files I'd made and no go. So I went back and did ruby -v again and once again I'm being told Ruby isn't installed. Well, it was installed half an hour earlier and I hadn't uninstalled or moved it in the meantime :(
     
  19. scifisam

    scifisam feck! arse! girls! drink!

    Is there a Rated People for tech jobs or anything like that? You know, where you could put up a small job and someone who actually knows the answers can come round and sort out the bloody problem? I don't see much point spending more and more hours doing the same things again and again just to get Ruby working on my bloody computer. I feel like I need someone to programme my video for me :(
     
  20. PaoloSanchez

    PaoloSanchez Well-Known Member

    tbh this appears to be a little bit of a muddle.
    1. check that ruby is installed by running ruby -v at the command prompt.
    2. if your path is set up correctly, the ruby command should work regardless of your directory location.
    Should look something like this...

    upload_2018-4-4_22-33-17.png
     
    existentialist likes this.
  21. scifisam

    scifisam feck! arse! girls! drink!

    Ruby -v shows me the version, so it is working. It stopped for a while for no fathomable reason and started working again for no reason too.

    It's just not finding anything. Doesn't matter what I do to change the path (like putting in the whole path) nothing works. Doesn't look a bit like your picture, either.

    upload_2018-4-4_22-40-22.png
     
  22. alan_

    alan_ Well-Known Member

    I managed to set it up and get it running to the point where it would output jello world (but it output it via the text editor of choice in my case visual studio)
    Did you manage to strip off the file extensions (txt. or whatever) and make specific ruby extensions (.rb) that is another reason that the paths will not be recognised
     
  23. PaoloSanchez

    PaoloSanchez Well-Known Member

    Not sure what's going on there tbh, still seems to be a bit of a muddle.
    You appear to be running a batch file with ruby commands in it. Not sure what's going on with the "Gemfile.txt" wth is that? :confused:
    Try running the ruby commands directly from the command prompt individually to see if they work.
    You said you've already run ruby -v a couple of times and if that is still working and your path is set correctly then you shouldn't have a problem executing your 'jello world' ruby script.
     
  24. scifisam

    scifisam feck! arse! girls! drink!

    The gemfile thing is supposed to be bundle a load of software.
    None of the ruby commands work directly in the cd prompt (are they supposed to?), they just say file not found.
     
  25. alan_

    alan_ Well-Known Member

  26. alan_

    alan_ Well-Known Member

    Above is a wrong path then a correct path. When correct, the text editor opens (visual studio) and the jello world was echoed
     
  27. xenon

    xenon Sacred moche hat combat

    You have to type ruby on it's own, then type the commands in those files. Typing ruby on it's own will put you in the ruby interpretor. (Or should do.)

    I'll shutup, I don't even use it...
     
  28. alan_

    alan_ Well-Known Member

    all of those gemfiles have the file type txt. You have to take that off. Open "view" and when you can see the extensions rename them without extensions..
     
  29. scifisam

    scifisam feck! arse! girls! drink!

    They don't actually have txt as a file extension, so I don't know why it keeps coming up as one and I can't remove it because it's not there to remove.

    I'm going to try the rest you've advised when I figure out what you mean :D
     
  30. alan_

    alan_ Well-Known Member

    They do even if you cannot see it. There is a menu choice to show files PLUS extensions (they are hidden by default) you must find it and change them else it is pointless doing anything else
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice