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

View all comments

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!!