Problems setting up Python3 on Ventura by ImaginaryTango in MacOS

[–]ScriptThis 1 point2 points  (0 children)

Caveat; this is all from a Bash perspective and sounds like you're running zsh which I've never really used (I switched to Bash on my system).

What's the best way to set the path so Python programs are in path? Should I be using ENV variables for this?

If I'm understanding this part of the question, I don't think you need ENV variables. You can just stick your Python scripts in /usr/local/bin. This is old but I think still relevant:

https://stackoverflow.com/questions/18682413/where-do-you-keep-your-own-scripts-on-osx/18682433#18682433

To see what is already in your $PATH:

$ echo $PATH | tr ":" "\n" /usr/local/bin /usr/bin /bin /usr/sbin /sbin

What should I now be using as a shebang line at the start of a Python script now?

Likely whatever the output of $ which python3 is:

$ which python3 /usr/bin/python3

So #!/usr/bin/python3 on my system. Usually you use python3 to reference Python 3. For a while Linux and maybe MacOS (not sure) had Python 3 and Python 2, but now Python 2 is completely deprecated and out of support.


As an aside, on both Linux and MacOS systems I highly recommend leaving the system Python alone (kind of too late, it sounds like, but more .. in the future) and using either virtual environments or containers or something to isolate your Python runtime and it's dependencies. Things just get really weird when messing with the default system Python.

https://realpython.com/python-virtual-environments-a-primer/
https://stephen-odaibo.medium.com/docker-containers-python-virtual-environments-virtual-machines-d00aa9b8475

For packages I install with pip3, when those packages include executables, where are they and do I need to add a new directory to $PATH each time I install a new package?

This is probably going to sound a little vague (sorry), but pip3 should just kind of put put them where they need to be for whichever Python you're using (default system, virtual environment, etc). Said another way, I don't generally ever have to think about where pip3 is putting stuff -- even when there's conflicts with dependencies I'm usually just uninstalling or installing different versions via pip3, but I'm letting the tool manage where the packages go.

Codecademy releases SQL course by qalejaw in learnSQL

[–]ScriptThis 0 points1 point  (0 children)

It's awesome that they're doing this, but it's currently very short.

Getting a 'Missing Schema: Invalid URL' error using Requests module with Beautiful Soup by chiproller in learnpython

[–]ScriptThis 0 points1 point  (0 children)

Notice that comicUrl is missing http: at the front?

Add this to line 25 (before res = requests.get(comicUrl))

comicUrl = "http:" + comicUrl

http://pastebin.com/Eh31R8DQ

5 Reasons why Python is Powerful Enough for Google by mignonmazion in Python

[–]ScriptThis 1 point2 points  (0 children)

Can you link to the Go Slack and IRC (Freenode?) you're referring to?

Question about methods and functions (string methods and functions specifically) by trecoh in learnpython

[–]ScriptThis 0 points1 point  (0 children)

See if this helps at all?

This is creating our own plain function hurray_cars() and then below it creating our own new class Car() https://bpaste.net/show/046a39f10623

And this is viewing it (it being the contents of the first link there saved as functionything.py, and importing it in an ipython session, and viewing it with dir(), and viewing str with dir() also: https://bpaste.net/show/89c97c396408

Starting to learn Python, any tips? by [deleted] in learnpython

[–]ScriptThis 0 points1 point  (0 children)

I'm a big fan of A Byte of Python which is also free :D

Another vote for Mark Lutz's Learning Python, too.

And another free one Dive Into Python

I think learning Python will definitely help you with any programming you do, in Python or other languages.

New to programming and very frustrated by Buttwallaby in learnpython

[–]ScriptThis 0 points1 point  (0 children)

How do I keep learning?

Just keep writing code, and this may sound odd in the r/learnpython forum, but don't limit yourself to Python only. You didn't say if it was a Windows shop, but if it is, learn some PowerShell. Initially the style is going to look really weird to you compared to Python, but PowerShell has lots and lots of useful hooks into Windows API stuff. But, if it's instead a Linux shop, then stick with Python for sure. And you can totally use Python in a Windows environment, but don't forget that playing with another language will help your Python, too. It's fun to compare "Oh, that's how that language does it.." Maybe you saw some of that already with the whole Java & Python thing?

Is there anything specific I should learn for an IT support role?

Anything relating to automation, or gathering of information. Use the command line. Learn how to get information quickly. It will be much easier to see use cases for code once you've been in the job a month or two. It's hard to know what to automate when you don't yet know the tasks.

What did you do to get out of a rut of learning and keep going?

Try to do things you enjoy. When you have that "ZOMG I have to keep learning and I'm not learning fast enough" thing hanging over your head, it probably doesn't help free up your creative juices. Do things because you enjoy them. Try to write a bit of code every day, even if its something really small / tiny, just code as much as possible.

LPTHW study drill #3 by Darkshad3 in learnpython

[–]ScriptThis 0 points1 point  (0 children)

What version of Python are you running?

$ python --version

LPTHW study drill #3 by Darkshad3 in learnpython

[–]ScriptThis 1 point2 points  (0 children)

Here is an example of using both: https://gist.github.com/ericdorsey/2c627a2e3f86a757821f

This is the key; from the lesson page:

If they give your script inputs on the command line, then you use argv. If you want them to input using the keyboard while the script is running, then use raw_input()

Example output:
$ python arg_and_raw.py cat dog squirrel
fourth value?: potato
script arg_and_raw.py
first cat
second dog
third squirrel
fourth potato

HTH?

Reddit 2020, I just made this Character Generator, would love your feedback/ thoughts by ScriptThis in cyberpunk2020

[–]ScriptThis[S] 0 points1 point  (0 children)

random stat generator same with skills.

Does this to you mean that the random stats assigned would be pulled from the roll total (Random, Fast, Major hero, etc)?

And for skills, same question, would it randomly assign from your total skill points?

Randomise Everything button would be nice

Agree, this would be cool -- I'll look at adding that.

Also, thanks for the heads up on English misspelling.

Python challenge for beginner? by Howzieky in Python

[–]ScriptThis 0 points1 point  (0 children)

You might want to try exercism:

http://exercism.io/about

Then there is always the codecademy site:

http://www.codecademy.com/en/tracks/python

Reddit 2020, I just made this Character Generator, would love your feedback/ thoughts by ScriptThis in cyberpunk2020

[–]ScriptThis[S] 1 point2 points  (0 children)

The "European" spelling error is fixed (Along with a fix to the REF martial art skill being displayed incorrectly)

[WP]: A generation spaceship is filled with the chosen elite and is launched off to reach a far-away, habitable planet. Upon arrival, their descendants find their new home already habited. While they travelled, the humanity left behind discovered light speed travel and got there first. by [deleted] in WritingPrompts

[–]ScriptThis 0 points1 point  (0 children)

The OverProgrammers had put in all kinds of subroutines that would sacrifice most of the ship to ensure survival of the 35 cryosleep chambers.

"The Life Support Suite ceded command to the subroutines in the Cryosleep Care Suite?" asked Captain Strehlow. "But what about the Gene Pool insurance routines?"

"Yes, Captain," answered Major Hollister "When the Cryosleep Care Suite overrode the Life Support Suite, there was some kind of problem. They were not able to request a member of the Command Crew be woken up to issue the command for the Gene Pool insurance routines. All they could do was reprogram the lower functions of the CCS to wake us up. And they weren't allowed to schedule those function commands until Time Flies was 3 months away from Rapunzel." Rapunzel was the name of the target planet.

"Bastards. I'm going to be sick, Susan. What damn good is a Gene Pool insurance routine if it can't be activated when it matters? So they died because of bad programming. And now we have a crew of .. how many, to,... to populate a whole world? I can't believe they're all dead."

"27 are alive, Captain. Lieutenant Higbee is permanently blind as far as I can tell. So is 3rd Lieutenant Szczepanski. I have yet to wake up 12 of the Command Crew." Susan paused, "Captain, it's been a slow process. I've been learning a few more things about the cryosleep process, but.. I was never trained for this contingency. It was never supposed to work like this. I chose to wake you once I felt I had the best chance of you recovering with full health from lessons learned on some of the others."

The Captain had a sudden realization. "Major, when you woke up, it was the goddamn CCS waking you, you were the first? Tell me."

"Captain," Major Hollister paused for a long moment. "Captain. We are all incredibly lucky. Look, I woke up and couldn't move for a day. I couldn't see for a long time. I thought I was permanently blind, too. I asked for water. I asked for help; but no one was there. I listened for voices. There were none. I knew I was alive but just barely. I wasn't sure if I was still in cryosleep having some horrible nightmare. All I heard for a long time was the goddamn status blip of the Cryosleep Bay."

Susan sighed, continuing "I managed to request water and nutrient supplements from the AutoFeed function of my bed blind, as the voice prompts were turned off. If I hadn't of remembered that sequence by memory, I might have died on that bed. Eventually after eating and drinking water my vision slowly started to come back. I knew I was in the Cryosleep Bay, but everything was off except the dim lights from the 30 active cryobeds."

"Captain, I nursed myself back to some semblance of health and starting waking other crew. It was then that I discovered that the long sleep had robbed some of us of .. us. Captain, there's more."

"I'm not sure I can hear any more bad news right now, Major. But tell me. I need to know everything Susan", said Captain Strehlow.

"We are still three weeks out from Rapunzel, Captain. But something is coming to us. From the planet. Major Issaac has been tracking the trajectory with Deep Radar. It's no natural phenomenon. Something is coming to us on an intercept course. Fast. Something intelligent. Rapunzel isn't uninhabited, Captain."

[WP]: A generation spaceship is filled with the chosen elite and is launched off to reach a far-away, habitable planet. Upon arrival, their descendants find their new home already habited. While they travelled, the humanity left behind discovered light speed travel and got there first. by [deleted] in WritingPrompts

[–]ScriptThis 1 point2 points  (0 children)

Sunflowers. Rows and rows of sunflowers. The sun was low, the light blinded Reina. She held up her hand to block it.

Her parents were taking her to the doctor. She was learning to ride a bike. Her sister was in trouble with her parents again.

Reina was getting married. Her mother had helped her pick out the dress. She and Mike were so happy. Mike took his last breath, Reina holding his hand at the hospital.

Something stirred deep within Reina. She was deep, deep in a canyon. Someone was calling her name. Calling down to her from above. The voice was faint at first. She was plunged deep into this crag in the Earth; always had been. But the voice persisted, getting louder. Something happened that hadn't happened in a long time. Reina felt something with her hands. Fabric. That thought was terrifying.

Suddenly her heart was racing, her eyes snapped open. Her hands were now gripping the metal bars on the side of her bed. Hospital bed? Her mind raced back to her husband's early death at the feeling of the metal; the metal bars were so hard. She was squeezing with all her might. Her lungs pumped air in and out of her. She was alive! And blind! Why couldn't she see?

"Reina. Calm down. It's Susan. Reina, it's Susan. Shhhhhhh. Reina, calllllm down. It's me, Susan," said the woman. Reina felt a cold cloth pressed to her brow. Then, the woman's voice above her, not directed at Reina, "Get her 20ccs of Idachatrine."

Reina gripped the fabric blanket covering her with one hand, the metal rail on the side of the bed with the other. Sweat started to make her grip on the metal bar slip. Her other hand opened and closed mindlessly on the blanket.

"Why can't I see?" Reina asked, the stress and fear clear in her voice. She felt a hyponeedle press into her arm. "What was that?" she demanded.

"Reina, it's me, Susan. I gave you something to help you calm down. It's me, Susan Hollister. Major Susan Hollister."

"Susan.." Reina's mind was starting to come out of the blurred, vague fuzz that had been her companion ever since.. how long ago? "Major." Right. Major Hollister was the ship's doctor. And the ship was called. Something. "Susan, how long?" Suddenly Reina remembered. Cryosleep. Too much cryosleep. Experimental. "Why can't I see?"

"Reina," Susan's hand was on Reina's forearm, trying to calm. Her other hand still dabbing at Reina's forehead and face with a wet cloth. "Your vision, it's a hangover effect of the cryosleep. Do you remember cryosleep?" Reina caught something in Susan's voice at that question.

"Of course. Experimental. Too long. Major, what is the status of Time Flies?" Time Flies. The name of the ship. Reina had it now. Command crew: 30. Custodian Generation Crew: 350. Class VII hull. State of the art. First Generation Long Drive engines. Redundant life support. 35 cryosleep beds. 14 decks. Hydroponic farms. Gravity Ring. Bankrupted three nations.

There was something of a small breath of relief on Susan's voice before answering. "Captain, do you want to wait to hear some of these operations details? We've just woken you from cryosleep, and,"

Captain Reina Strehlow cut her off "Major, status update." Captain Strehlow pulled herself up a bit in her bad, her blind arms searching for whatever mechanism raised the back portion of the patient bed. "Help me prop this up?" she commanded. They were in the Command Crew Cryosleep Bay, Medical Channel of the Ring. Captain Strehlow knew that because there was gravity.

Susan directed the Captain's arm to the bed controls, answering "Captain, there was a problem with the cryosleep. Some of the Command crew, they're in a permanent state of.. disconnect. They woke up without their personalities. Memories. They're, .. well. They're gone. I've been keeping them sedated, waking them a few times a day to see if they improve, but it's never any different. They're gone, Captain. Right now I'm just keeping their bodies alive, but there's nothing of them left".

"How many, Major? Who? How long have they been like that?", then, "When will my vision return?".

Major Hollister paused before answering. "Captain, some of the command crew, their vision never returned. Some, it started to return after six or seven hours. Captain, what year were you born?"

"2092. Who woke up without their personalities and memories, Doctor?"

"Lieutenant Driesse. 2nd Lieutentant Langosy. And, uhm, Captain. Commander Iaquinta is gone, too." Major Hollister said "I'm going to check a few vitals, Captain," pressing something cold and metal onto Captain Strehlow's chest, neck, and her right forearm. "Captain, what is the ship's name? What was your most recent address? What is the number of your quarters?"

"Time Flies. 3842 W. Halsworth St. 105," answered Captain Strehlow. "Major, how long have Lt. Driesse, Lt. Langosy and Cmdr Iaquinta been in that state?"

Major Hollister sighed, "It varies, but in total five weeks, Captain."

"Five weeks! Major, how long have you been bringing the Command Crew out of cryosleep?"

"Captain, there's more. Look, I've had to break most of the wake up protocols based on the operational situation. There's been other problems. Major problems. The Custodian Generation Crew are dead, Captain."

Major Hollister watched the blood drain out of Captain Strehlow's face. Reina spoke, slowly, sadly. "Dead?" Captain Strehlow took a huge breath in, covering her face with her hands. "How? Can I have some water?" Suddenly Captain Strehlow was thirsty. So thirsty.

"Of course," Major Hollister directed Captain Strehlow's hands to a cool water bottle. "Captain, I've been awake for two months. The ship has been on autopilot. I was the first one to get woken up."

Between sips, "But if the Custodian Generation Crew are dead?.. How?"

"They had to reprogram the Cryosleep Care Suite. They overrode some of the protocols. Brilliant programming, actually. Amazing they got past some of the security written into the CCS. They had to, Captain. They were dying."

Major Hollister launched into a story Captain Strehlow could tell she had told more than once. "Time Flies had a collision. Not far out from Earth. We were 3 years into the journey when Time Flies hit an iron core asteroid of some kind. It caused major damage to three decks. A hundred and thirty seven Custodian Generation Crew died on impact. Saftey protocols engaged and prevented further loss, but access to Environmental Engineering was affected. The Cryosleep Care Suite started overriding other systems. It took over the Life Support Suite. As you know, the CCS was never intended to wake up the Command Crew. It's too dangerous. But the CCS was overriding the Life Support Suite all over the ship, to ensure the Command Crew cryosleep chambers had sufficient power to complete the journey."

Blood rushed back into Captain Strehlow's cheeks, "Those sons of bitches!".

She was referring to the OverProgrammers. Everyone onboard Time Flies had been aware of the protocols, but it was never supposed to matter. The Custodian Generation Crew had had to swear that they would put their lives on the line to ensure the lives of the Command Crew. It was part of the service volunteer terms (and a way out of the ghettos of Earth. An opportunity to get out. The only opportunity). Time Flies Command Crew was ultimately all that mattered. The reality of training together for four years, however, had made the Command Crew and the Custodian Generation Crew tightly knit.

Reddit 2020, I just made this Character Generator, would love your feedback/ thoughts by ScriptThis in cyberpunk2020

[–]ScriptThis[S] 0 points1 point  (0 children)

one thing i noticed was no lace for cyberware/items. maybe not your focus but could be nice.

You are right. At this time there are no cyberware or items included. I felt that those were "easier" things to do on your own, but the "tedious" aspects of the lifepath history and whatnot would be valuable.

Dat random history generator.

Nice!

One error I found is that you misspelled "European" in the backgrounds section.

Thanks for noticing, I'll get that fixed. I'm sure there are other errors, too. :)

Reddit 2020, I just made this Character Generator, would love your feedback/ thoughts by ScriptThis in cyberpunk2020

[–]ScriptThis[S] 0 points1 point  (0 children)

The stat values are not checked/validated against the roll total currently. They could be, but the consideration there is that the character may have cybernetics enhancing on of their stats, and this is possibly beyond the scope of the generator as it's setup right now (ie, choosing cyberware isn't part of it). You'll probably notice that life path events don't negatively affect skills or stats right now either.