r/learnpython • • Jul 17 '19

What is the point of python?

I have spent the last couple of days building a python program, and have only been learning python for a couple months or something at this point. I'm really happy with the progress that I've made, this program that I've been making is doing what I want it to and I was ecstatic when I went to bed at 3 am... lol

Today though all that excitement has burnt up trying to figure out how I'm practically going to use this program. The program was built to automate data entry for my job, I deliver pizza for my full time job right now. I'm never in front of a or my computer when I'm delivering pizzas. I was really hoping I could run the program on my android phone.

I tried to use chaquopy with android studio, but I have no experience with android studio so I couldn't figure out how to use it or how to install chaquopy to a AS project. Also python is my first programming language and I'm not ready to learn java just for the sake of making android apps. I also tried to use BeeWare but I think I'm to new to python to be able to use these tools. I also tried to use QPython, which would run the program just fine and I could do all the inputs required to go through my program. This program I'm making requires the writing and appending of files, and QPython wouldn't create or edit the file like it does from IDLE shell.

I'm really frustrated by this limitation, because everything I did was basically for nothing at this point. I've also thought about running teamviewer on my pc and then using the teamviewer android app, but in the past trying to control a pc from an android device in such a manner was very unwieldy and I don't think it would be worth the hassle.

Why is python so self contained and how does one get its usefulness in a more practical manner?

the program in question: https://github.com/itwasntzak/deliveryTracking

Edit: I've also somewhat looked into trying to run the program as a web app through googles app engine environment. Again, I feel I'm to inexperienced in this new vast world of programming to use this implementation. It's also not the most desired implementation, because I live in a very rural part of america. Verizon has a very strong monopoly where I live, I tried to get a cheap phone off amazon and this phone turned out to be GSM instead of CDMA. I got my service though straight talk and they have support for GSM, but only conditionally thought CDMA towers. I constantly lose service thought out the day, and have to restart my phone to get it to even connect to data. When it is connected, the vast majority of the time it is incredibly slow and takes for ever to load even the most basic webpages. This wouldn't be the best way to go for me either because I might spend more time waiting for the program to load and the automation benefits would probably be lost to the waiting times. \

Idk, I'm frustrated lol please give me some advice on what my best course of action will probably be!

1 Upvotes

24 comments sorted by

19

u/Achie37 Jul 17 '19

First, clam down. If you wanted to build a mobile app, you should've done research into what would be the best language to do it in. It's not the language's fault that Android phones don't let you run python scripts by default.

Try looking into Kivy, it looks like what you're looking for. Also, your code looks good for someone just learning, don't think of what you did as a waste of time.

1

u/itwasntzak Jul 17 '19 edited Jul 17 '19

I am calm! haha I'm sorry for my clickbaity title, it just felt good in the moment. I don't blame python for not running on android, I know that androids fault for not implanting native python support with their development tools ;P

I didn't actually learn it to make mobile apps. I started learning it because the music production software I use, Abelton Live has native support for some usb midi controllers. The controller I have is not support natively, and after looking around I found you can make any controller basically do anything in this software but you had to make a custom controller script. Those scripts are made with the python language, so I dove in and started learning it. After learning the basics and realizing what it was actually capable of, I got inspired and had some ideas on things I could make. This program for my delivery job is one of those things, and after making what I have thus far I realized I didn't have a way of actually using it at work like I had planned on.

So I came here with my clickbaity title looking for help lol I will check out Kivy, thank you so much!!! And thank you for complimenting my code :D haha

9

u/A_History_of_Silence Jul 17 '19

Why is python so self contained and how does one get its usefulness in a more practical manner?

I consider Python to be one of the most useful programming languages ever created. By pure chance, you happen to have run into one of the relatively few areas where Python basically just isn't the right tool for the job. That's the way things are sometimes - bad luck. It's the same as if you wanted to do some client-side animation on a website; Python simply can't help you. You need to learn Javascript (or perhaps something that compiles to Javascript), and there's nothing that can be done about it.

Idk, I'm frustrated lol please give me some advice on what my best course of action will probably be!

Don't get discouraged. Everything you've learned about programming in Python will still help you when you go to learn other languages.

However, personally I would avoid thinking about mobile apps in general until you've got some more experience. Even as a fairly seasoned developer I find mobile development to be a goddamn nightmare, to the point where I instantly reject jobs where that is a requirement.

Bummer this got so many downvotes, I think you asked a reasonable question.

3

u/itwasntzak Jul 17 '19

It's good to hear that what I've learned from python will make other languages easier, I had to teach myself the basics of "computer science" also when I first started learning. I didn't even have the foundation knowledge to really grasp a lot of the basic programming concepts. I understood the idea of "if this, then that" and that was about the extent of it lol

I'm not to discouraged as a whole, I have ideas for more programs that can actually be interacted with while I'm at home on my computer. I just spend 10+ hours a day at work delivering pizzas, and I saw some spots where I could increase my efficiency. All I do all day is drive, so while I'm at work my mind has just been running wild with all the functionality I could add to this program.

Then to run into this limitation, in what was going to be one of the more basic parts of this program, just crushed the dreams I had for the rest of the program lol Most of the things I want to do with this program are still possible, it will just be more time consuming. I was really looking forward to easy of data entry/compiling on each delivery. I know python is more then capable of this task.

This is probably a bit ambition since I'm just getting into this world, but I would like to build a custom headunit for my car that has a raspberry pi for the brains. It would still be a headunit, sending audio to the speakers, but I thought I would also be cool to add obd interfacing and control as well as, lighting and other things to the car that could be controlled through the raspi headunit and micro controllers. I had the idea to do this for a while, then I found out python scripts can be run on a raspberry pi and that got me even more hyped lol I could try to get a basic little mobile raspi unit going that I could take with me to work.

I will avoid the thought of mobile apps for now, I had just watched a video from team tree house on youtube about android studio and it seemed so easy from the video. When first watching the video, I actually thought android studio made programming android apps a visual programming language . That is definitely not the case and it was no where as easy as they made it look lol maybe the visual aspect was just the actual layout of the gui.

Thank you for your time in responding! I think it got so many down votes because it probably sounded like I was saying python wasn't a capable language or something of that nature. Which wasn't my intention, I was just feeling down when I wrote the post and my negativity probably shined through. I also tried to come up with a title that would grab peoples attention so I could get help lol I figured if I asked what was the point of python in the learnpython subreddit it would probably get me the attention and I guess it worked xD lol

3

u/A_History_of_Silence Jul 17 '19

I hope you consider making programming a career. Spending 10+ hours a day delivering pizza and still teaching yourself a programming language in your spare time and even displaying a github project to the public is quite impressive. I'm 100% serious when I say I think you should start applying to some entry-level Python jobs if that is something you are interested in. From what I've heard so far, you are absolutely hireable. Good luck with your project!

1

u/itwasntzak Jul 17 '19

I'm defiantly interested, I don't mind delivering pizzas but I defiantly don't want to for the rest of my life lol Having a AAS degree (unrelated field to programming or pizza) and still working full time as a delivery guy is somewhat soul crushing.

I'm very interested in getting an entry-level programming job, I have no clue where or what jobs like that would be though. I live in Wyoming so there probably ins't that much opportunity for it here, unless I create my own opportunities. I'm looking to move to another state, its just not an option at the moment.

I also have an issue of self worth lol, anytime I try to think about applying to a job that isn't delivering pizza or a cashier at walmart I feel like I have nothing to offer anyone. Logically I know this isn't the true but its convincing myself that is the hard part. Your comment made me feel a lot better about myself though, so thanks for that!! :D lol

I will try to look into entry-level python programming jobs, hopefully I can find something that I can do remotely.

2

u/A_History_of_Silence Jul 17 '19

hopefully I can find something that I can do remotely

Not to discourage you, but from experience I can tell you this will be extremely difficult for entry-level. Gotta move outta the sticks, lol.

As for the self-worth and such... Just apply to every single job you want. You may fail a bunch of interviews, but that's fine and normal. You only have to get accepted by one of them. Due to various weird factors, the 'requirements' in many programming job postings are often insane and unrealistic. Here's a video on the topic: https://www.youtube.com/watch?v=6G3kQyqMFpQ, but there are dozens more with a similar sentiment.

1

u/itwasntzak Jul 18 '19 edited Jul 18 '19

No worries not discouraged, it makes sense. When someone is so new to something it would be dumb to just leave them on their own to do the work you need of them. It would probably be setting the employee up to fail and the employers up for disappointment. Where if you have a season veteran of a subject, they probably have a lot of work to show how capable they are, and that person can probably be trusted more on their own to get work done.

I live maybe 30 minutes from the Colorado border, and my friend said that there is a lot of tech jobs right now in Nother Colorado. So maybe I'll try to commute or something until I'm in the financial situation to be able to move.

I will try to apply to a lot of different places, thank you for your help!!! I have definitely noticed that myself, in most fields employers seem to be asking for a lot of experience of entry-level positions. Which is nonsense since those are supposed to be the ways to gain experience.

2

u/[deleted] Jul 17 '19

Possibly teamviewer? Access your desktop remotely and run the script that way. Otherwise, the other commenters have covered your other options

1

u/itwasntzak Jul 17 '19

I haven't tried teamviewer for this particular application before. I have tried using my phone and teamviewer like remote control with hulu, when I had my computer plugged into my tv and I was laying in bed. It was a very unpleasant experience that didn't work very well. However this was in like 2012 so it may be more user friendly now, I'll give it a shot. Thank you!!

2

u/[deleted] Jul 17 '19

I havent tried it either, it was just the first idea that came to mind. Good luck and let me know if it works by chance!

2

u/Losupa Jul 17 '19

Python’s “purpose” is that it is an incredibly easy to learn language with a wide variety of packages run using an interpretator. This means the python code you write runs on any computer system as long as the interpreter and relevant packages are installed. In fact a lot of computationally heavy packages are just wrappers for C libraries (such as Numpy and Pytorch) which means that Python can be incredibly powerful as well.

This makes it great for prototyping and pumping out code quicker and easier than dealing with all the setup, compilation, and low-level problems you see in C++ code, and if you do it right it will take “relatively” the same time to run.

On that note, for your project specifically if you want to remotely use your program (from work or such) you can run it on a server of some sort and either ssh into it from your phone, or you can also make a website (on the same server as the script) and interact with the script using that.

1

u/itwasntzak Jul 17 '19

I did learn that it is one of the most easy languages to learn, with it also being extremely powerful. I read those two factors are what is leading it to be the most popular language in the future. When I ran into this limitation it just kind of put this thought in my head that it's very self contained like people made programs for their own needs and just ran them on their computers at home or if they worked in offices where they could install python and use an interpreter. It felt like it wasn't particularly practical from a consumer perspective, I know this is probably just my pessimism in response to the hurdle presented before me. I wasn't trying to talk bad about python as a hole, just what I was experiencing.

Thank you for both of those ideas on how I can make this work for my situation. I will learn about these and try to implement them! Thank you again!

2

u/thekaizers Jul 17 '19

I use Qpython on my Android phone to write and run code

1

u/itwasntzak Jul 17 '19

Do you know if there is something I can do to make it access the directory/ file system and be able to write to it?

I can add my files to the folder system, and I can access my .py files with Qpython. My program requires writing and appending of files that are being saved in a folder inside the main project folder, it can also be saved in the same folder as the .py files if need be.

I got my program to run in the Qpython terminal and it seemed to be running just fine, it went through all the function like it does on my computer but when I went into the file system it wouldn't create/write/append the files I need it to be creating.

2

u/thekaizers Jul 17 '19

I've only ever written to files in the main folder. I've never tried to write to a different folder.

2

u/huttonben Jul 17 '19

First of all.. the only one to blame here is yourself.

Python is not the problem. Lack of research before diving into what your trying to accomplish is the core issue. Python is an unbelievable language with so much to offer which is why it's rapidly growing.

That being said, you have options. Look into Kivy for mobile app development with Python. Kivy is nowhere near where it needs to be yet but it'll get the job done. It just won't run as smooth as a native application would. If you really want to develop apps, learn the native language for Android and the native language for iOS. (Java, Kotlin, and Swift).

The pros to python are numerous. It's extremely human readable, memory management is a piece of cake, it's the king of data science (ML, etc). Web development in python using Django or flask is music to my ears. The libraries are endless and automation is so simple. Not to mention it's probably the easiest language to learn and it's highly flexible. All that being said, python isn't perfect, nor will any language ever be.

Respectfully, you should do your own research to understand why different languages are utilized more for different things and understand the concepts behind all of that before blindly writing a program and then being frustrated bc you can't put it on the app store in 2 seconds.

1

u/itwasntzak Jul 17 '19

I responded to the other comments saying, I'm not actually blaming python for not being able to run on android. Nor did I learn python with the intention of making mobile apps, I learned python for a specific reason and then because it is so capable and easy to learn my imagination went wild.

I have many more ideas for other programs that I plan to make with python. I think I let my emotional negativity shine on python when I was really trying to shine it on my frustration. I did do a little bit of research before hand and saw that there were ways to package a python program to run cross platform and I jumped to conclusions with that information.

When I started writing this code I didn't really have in mind how I was going to run it. I just had so many ideas and I wanted to being them into reality, which is what I did. I'm very happy with what I've made so far and it does what I had in mind. With that being said, after I got to point of being happy with how it ran I started looking up how to run python on android. And now we are here lol There seemed to be option out there for running python on android when I was doing the research, options I mentioned in the post. But the implementations were much more difficult then even just learning python on its own lol

I apologize, it was really not my intention to make it sound like python was inferior in anyway. I know its very powerful, incredibly easy to learn and the fastest growing language out there right now. I'm semi necrotic so you'll have to forgive my out burst haha

2

u/huttonben Jul 17 '19

Haha no worries dude.. I know the feeling. I just say what I said bc I've been there and had to learn the same things. Look into web dev with Python and Django. Bet you'd enjoy it 👍

1

u/itwasntzak Jul 17 '19

I will definitely look into that! I already some basic experience with html and css so hopefully that will make it a little easier.

Thank you so much for that recommendation, I'm going to get right to it!

2

u/redCg Jul 17 '19 edited Jul 17 '19

Sorry to hear about your frustrations.

Programming is all about choosing the right tool for the job. But it can be very hard to know what the best tool might be without having the experience to know what kinds of software are used for what purposes.

Python works best when running on Linux servers that you have control of, and by extension on macOS and Windows computers. Android and iOS do not run it, at least not natively in app form in any way I'm aware of. Unfortunately I do not think I have ever seen a tutorial that clearly explains this to students up front. It's always kinda just assumed that if you want to learn Python then you've made an educated decision in choosing it.

What is possible though is to create a web server with Python that your app could talk to. But if you didn't design your app from the beginning as a Flask or Django web app this would be a lot of extra stuff to learn and you would have to change a lot of your program, in addition to learning how to build the Android/iOS app to communicate with it. You would also have to set up hosting for the app (might not be free).

If you are dead set on making a mobile app then you are better off pursuing the languages used for that. If you want to salvage the Python work you've done then start looking into Flask and Django web app development.

But really I think you would be better off simply taking your laptop with you and running the program through that while working. Just don't try to type and drive at the same time please 😅

1

u/itwasntzak Jul 17 '19

Thank you for your response!! Making mobile apps was not my intention when I first started learning python, I just saw an opportunity to automate some of the tasks I do everyday at work with python. After already writing the program I started to think about how I could use it while I'm at work, and then I made this post haha

I do think ultimately I would like to learn Django, and make a web app and/or web sites with python as the back end. When I was in college I took something like a "web site building" class using dreamweaver. I had already learned DW in high school so while the teacher was teaching everyone that, I was teaching myself HTML and CSS. Very basic stuff but I still remember a little bit from that and I enjoyed making web sites so I think Django is a logical next step for me at this point.

However I would really like to start using this program at work like today/tomorrow, and I don't have a functional laptop (and if I did, I defiantly wouldn't use it while I was driving haha) I've heard its illegal to have "computers" in your car so I would be very cautious if I had a laptop to use. I have like three dead ones, two of them need new power supplies or new batteries I'm not sure. The other one I have is a friends laptop, they asked me to update the OS on it for them. I tried to do this and now it's a brick, so I gave him my functional laptop since I completely broke his lol

I think my best course of action from what someone else said to get this working ASAP is to set up a server that is running python on it and then ssh into it from an android ssh client. I've been trying to look up how to set a server up on my pc but I have windows 8.1 so there doesn't seem to be a lot of options, and I'll probably need to set up a vm running linux on it. I have no experience with linux though so that is requiring further education lol

If I had the extra money right now to buy the parts, I would try to build a little portable raspberry pi that I could just take with me to work. Maybe in the near future I'll try that, but for now I do think I'm going to try to set up a server on my pc and take that route.

Thank you again for responding and giving me advice! I really appreciate it!

1

u/redCg Jul 18 '19

Tbh setting up a server is non-trivial, I think you best bet would be to just find a cheap laptop, anywhere, and run it on that and take that with you in the car. Use it in between deliveries or pull off to a parking lot to plan the next routes.

1

u/itwasntzak Jul 18 '19

Yeah I found that out later last night/this morning. Windows 8.1 didn't really have much in the way of setting up a server in such a manner. I felt like my next best option was going to be installing a Linux vm and going about it that way. I have no experience with Linux though and couldn't really find the info I needed for in which distro would be best for what I was trying to accomplish. So I posted on the Linux help subreddit, asking what distro would be best for my intended purpose. They told me since I was such a new user this probably wouldn't be a good idea, because I wouldn't have the security or networking knowledge to protect myself from people completely taking over my machine. I was very much considering getting a cheap laptop after all the recommendations there. Some people recommend I try using Termux, a Linux shell (I think the right term is shell but I don't know for sure) on Android. It allowed me to install and use python from a command line, which did the trick for running my program. And thankfully it has the ability create/write/append and read files from certain folders in the Android file system, so I got everything working the way that I need to from Android now. Someone may have recommended this here but if so I didn't see it or don't remember.

Thank you so much for your help, I really appreciate it!

Edit: I realize now that I stated something I had already said in my previous comment lol my bad!!