• 0

ATOM - editor: how to set the paths - to Python


Question

hello dear  MX-experts

 

this is a question regarding the setup of a development-environment on a MX-Linux Machine, 

 

the questioin is: with the fresh  setup of ATOM - editor: how to set the paths - to Python

 

to begin with the beginning: 

 

i am pretty new to ATOM: first steps to configure to work with Python on MX-Linux

 

just have installed ATOM on the MX-Linux.

the question is: how to set the paths - to Python.
note: i allready have installed Python on my Mx-Machine.

Which packages do you suggest me to use … to run ATOM with Python!?

 

love to hear from you

 

11 answers to this question

Recommended Posts

  • 0

hi there  I am back again 

 

 

well on my MX linux python is allready installed - so this is done by default. 

probably i need to set the paths"? 

 

 

i try to run a python code and then i see if it works 

 

 

- btw. how to get conda - i did not find it in the installer of ATOM!? 

i googled and found the following: 

https://anaconda.org/anaconda/atom
 
 Description
 Atom is a framework for creating memory efficient Python objects with enhanced features such as dynamic initialization, validation, and change notification for object attributes. 

well should i go this way: 


 To install this package with conda run:
 `conda install -c anaconda atom`

found at the above mentioned site,,,  https://anaconda.org/anaconda/atom

 

 

which things do you add to ATOM to run it as a python-coding editor... 

 

love to hear from you

  • 0

dear Pythonists - dear experts here at NeoWin 

  

i am on MX-linux which is great. but there is no vscode (or even Codium) in the repos of MX-Linux. This is a question regarding the setup of a development-environment on a MX-Linux Machine,  unfortunatly there is no VSCode in the repos - so i need some alternatives: 

 

cf: https://forum.mxlinux.org/viewtopic.php?f=55&t=55936&p=565840#p565840

note: this is sad sad sad. We need to change this pretty soon. Do you have some ideas to get things done her.

 

regarding the actual situation:- on my actual machine.- i thought of using ATOM or PyCharme  i have some experience with both of them - but ATOM i used years ago. 

so here some question regarding the setup and the configuration - and adding packages:

 

the question is: with the fresh setup of ATOM - editor: how to set the paths - to Python to begin with the beginning:-which extensions and packages do you suggest for getting started. Can you suggest some of the most important..ones?

 

as mentioned above: i am (again) pretty new to ATOM: first steps to configure to work with Python on MX-Linux

just have installed ATOM on the MX-Linux.

 

additional: - the question is: how to set the paths - to Python.

note: i allready have installed Python on my Mx-Machine: there 3.7xy is installed. 

Which packages do you suggest me to use … to run ATOM with Python!?

 

look forward to hear from you

 

yours Tarifa

 

 

update:  now i encountered something new: Unable to start the Python language server ::  python -m pip install 'python-language-server[all]'

 

the question as of today: Unable to start the Python language server ::  python -m pip install 'python-language-server[all]'

 

added a pyhton code and suddenly i  got back the following waring 

 

    Unable to start the Python language server.

    Make sure to install pyls 0.19 or newer by running:

 

and the following one: 

 

    python -m pip install 'python-language-server[all]'

 

well  - to be frank ;: i am on MX-Linux and there Pyton is installed by default. So whats the fuss?!

 

 

i am not sure what ATOM wants from me now!?

 

can any body help out here

 

  • 0
  On 20/03/2020 at 22:15, tarifa said:

 

    Unable to start the Python language server.

    Make sure to install pyls 0.19 or newer by running:    python -m pip install 'python-language-server[all]'

i am not sure what ATOM wants from me now!?

Expand  

It's literally telling you in the error message the command you need to run!

  • 0
  On 20/03/2020 at 22:32, DaveLegg said:

It's literally telling you in the error message the command you need to run!

Expand  

Hi there good  day dear DaveLegg, many thanks for the quick reply - i have used ATOM years ago - now in these  days (ih have lots of sparetime due to Corona-lockdown here) i have time to work with Atom again.  It is a headstart. 

 

At the moment i am allready running python-scripts. So some of the complaints i just dismiss. - since it works either.. 

regarding the above message : this message shows up while i add a new file to my development folder -/which does not reside in the ATOM-folder - what may be a problem. 

Well in other words i put the files into 

 

martin/dev/ python 

 

while the ATOM-Editor lies is 


 

ATOM 


Davelegg - is this possibly the issue where the complaines are rooted!? The different paths ...

 

Again - if i run the script with packages/script - then all goes well and i can see that all works propperly

 

sorry for being the novice - and for asking dump questions.

 

have a great day

  • 0

ahh hi there DaveLegg just another question - this fits here very well - i guess that i do not need to open a new thread...

 

i have added Script-package -which works fine.

 

all is well now: one question:

 

running Python-Script: with script-pagage: where to see the output - where can i see the output of the script!?

i haver the screens divided and all i see is the following:

 

 

[Finished in 3.141s]

 

 

this is the script:

 

from bs4 import BeautifulSoup
import urllib

url = urllib.urlopen('http://meinparlament.diepresse.com/')
content = url.read()
soup = BeautifulSoup(content, 'lxml')

table = soup.findAll('div',attrs={"class":"content-question"})
for x in table:
    print x.find('p').text

# Another way to retrieve tables:
# table = soup.select('div[class="content-question"]')

 

see my screen ... how all is organized... - the question is:  how can i arrange the whole ATOM so that i can see 

 

a, the script 

b. the command-line and 

c. the output!?  .... which means - the output of the little bs4-script...

 

 

love to hear from you.. 

regards tarifa

 

 

image.thumb.png.310e2d36e76c815adffb3466cf2f62be.png

  • 0

hello dear DaveLegg hello dear fellows, 

 

 

above all. well i hope you and your family is well - and all goes well in your location. How is your town dealing with covit19? I hope that we can overcome this crisis soon. 

 

ad i get continued messages and as i encounter issues day by day i just add the findings here - perhaps we can solve them in this thread.  many many thanks to you and for any and all help. 

 

the topic of today: no kernel for grammar Python found - pykernel necessary - honestly?

 

well this is pretty confusing - i can run scripts - even in python. 

but after installing hydrogen  ( cf https://atom.io/packages/hydrogen ) i have encountered funny and very confusing things. 

i want to run a little python script - and while doing a test with hydrogen>run i get back the following message: 

 

see: 

No Kernels Installed
No kernels are installed on your system so you will not be able to execute code in any language.

 

(#)[Popular Kernels](#)[All Kernels](#)

No kernel for grammar  `Python`  found

 

Check that the language for this file is set in Atom, that you have a Jupyter kernel installed for it, and that you have configured the language mapping in Hydrogen preferences.

To detect your current Python install you will need to run:

    python -m pip install ipykernel
    python -m ipykernel install --user

 

Dave - well - what is pretty confusing  - is the fact that i can run scripts - also python scripts - with the package called script: they work pretty well ... 

what goes on here - i have no glue ... see the image: 

 

 image.thumb.png.5ec325b5ab931dfb061b0bba00284d87.png

 

look forward to hear from you 

 

regards

  • 0

 

 

update: well - i guess that Hydrogen requires more than a plain Python interpreter. It provides functionality much like a Jupyter Notebook.

 

If all i  want to do is run a small script, then I guess i should  just stick to the script package, or run it in a terminal.

 

but i want to see the output of the script - this is pretty important to me. 

 

 

  • 0

hi there - well i guess that there are still some packages missing on my machine. 

 

 

see the next trial

 

from bs4 import BeautifulSoup
URL = "https://www.worldometers.info/coronavirus/"
r = requests.get(URL)
soup = BeautifulSoup(r.content, 'html5lib')
countHTML = soup.find('divttrs = {'class':'content-inner'})

for countVar in countHTML.findAll('div', attrs = {'class':'maincounter-number'}):
    count = countVar.span

 

    

    

    - i get back the following result: 

 

 

Traceback (most recent call last):   File "/tmp/atom_script_tempfiles/0c9e3b30-6d27-11ea-84a4-095d4171334a", line 2, in <module>     worldometers.info NameError: name 'worldometers' is not defined [Finished in 0.069s]


 

   

i am on MX-Linux on Atom and i do not know why i get this back!? 

 

i guess that there is something wrong

 

i have to digg deeper what goes on here. 

 

 

see the next trial

 

 

import csv
import requests
from bs4 import BeautifulSoup

URL = "https://www.passiton.com/inspirational-quotes?page={}"

quotes = []
page = 1

while True:
    r = requests.get(URL.format(page))
    print(r.url)
    soup = BeautifulSoup(r.content, 'html5lib')

    if not soup.select_one("#all_quotes .text-center > a"):break
    for row in soup.select("#all_quotes .text-center"):
        quote = {}
        try:
            quote['quote'] = row.select_one('a img.shadow').get("alt")
        except AttributeError: quote['quote'] = ""
        try:
            quote['url'] = row.select_one('a').get('href')
        except AttributeError: quote['url'] = ""
        try:
            quote['img'] = row.select_one('a img.shadow').get('src')
        except AttributeError: quote['img'] = ""
        quotes.append(quote)

    page+=1

 

 

 

i runned this and i got back the following result: 

 

 

´https://www.passiton.com/inspirational-quotes?page=1
https://www.passiton.com/inspirational-quotes?page=2..
https://www.passiton.com/inspirational-quotes?page=n..
https://www.passiton.com/inspirational-quotes?page=44´

 

and besides that ´

 

 

Traceback (most recent call last):
  File "/home/martin/.atom/python/examples/bs_values_com.py", line 31, in <module>
    with open('inspirational_quotes.csv', 'w', newline="", encoding="utf-8") as f:
TypeError: file() takes at most 3 arguments (4 given)
[Finished in 55.861s]


cf https://stackoverflow.com/questions/60796795/web-scraping-in-python-with-beautifulsoup


i am just musing how and why i receive this. i am trying to figure it out. 
any help greatly appreciated. greetings

    

   

 

dear fellows  - i look forward to hear from you - i must figure out what goes on here.

 

Edited by tarifa
  • 0

dear Davelegg dear fellows, 

 

 

first of all - i hope that you are all well and all goes okay 

 

since it seems to belong all to the same issue and the same thing i add this to this thread. 

 

 


the question today is: How can we install the Python package other than using pip?th

 

 

i run Python on MX-Linux  - there is

 

 

root@mx:/home/martin# python3 --V
unknown option --V
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
root@mx:/home/martin# python3 -V
Python 3.7.3
root@mx:/home/martin# pip install pandas
bash: pip: command not found.

 

i have no pip on the machine:  if i want to install pandas with the following command it does not work

 

pip install pandas

 

 

well i guess that i first of all need to instal pip

 

  Quote

1) Find the package at PyPI - the Python Package Index .


2) Download the source code,
3) Read the INSTALL.txt or README.txt for clue on installation.
4) Usually installation is made of these steps
     $ python setup.py   build
     $ python setup.py  install
Expand  

 

If you do not have EasyBuild installed yet, or if you just want to install the most recent version of each of the EasyBuild packages, you can use one of the following simple commands:

 

using easy_install (old tool, but still works):

 

easy_install --prefix $HOME/EasyBuild easybuild

 

Note If we already have easybuild installed, we may need to instruct easy_install to install a newer version, using --upgrade or -U.

 

using pip (more recent and better installation tool for Python software):

 

pip install --install-option "--prefix=$HOME/EasyBuild" easybuild

The --prefix $HOME/EasyBuild part in these commands allows you to install EasyBuild without admin rights into $HOME/EasyBuild.

 

 

Note For pip v8.0 and newer, pip install --prefix=$HOME/EasyBuild easybuild works too.

 

but wait: this page tells us that pip should be no my machine: 

pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org or if you are working in a Virtual Environment created by virtualenv or pyvenv. Just make sure to upgrade pip.

 

Installing with get-pip.py To install pip, securely   download get-pip.py by following this link: get-pip.py. Alternatively, use curl:

 

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

 

Then run the following command in the folder where you have downloaded get-pip.py:

 

python get-pip.py

Warning Be cautious if you are using a Python install that is managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.

 

so after all i am a bit confused: what  should i do - if i want to install pandas

- the questions are:

- wich options do i have to install pandas without pip 
- besides that: am i able to install pip with a simple method without running into any troubles?!?
- what should i do have to look for the preliminary steps!?
- are there any stepstones or pitfalls here !?

 

 

Dear Davelegg - sorry for adding this also to the thread - but i guess that this is quite helpful since it belongs to the same area of scope and interest. 


love to hear from you

 

 

regards 

  • 0

hi there good day 

 

i gathered more insights:  note i run the following code on MX-Linux version 19.1 (where Python runs in Version 3.7.xy) with a fresh installation of ATOM - 


cf: https://stackoverflow.com/questions/60908216/how-to-handle-multiple-urls-in-beautifultsoup-and-convert-the-data-into-datafram


 

    import requests
    from bs4 import BeautifulSoup
    import pandas as pd


    def Main(urls):
        with requests.Session() as req:
            allin = []
            for url in urls:
                r = req.get(url)
                soup = BeautifulSoup(r.content, 'html.parser')
                target = soup.find(
                    "dl", class_="c-description-list c-description-list--striped")
                names = [item.text for item in target.findAll("dt")]
                names.append("url")
                data = [item.get_text(strip=True) for item in target.findAll("dd")]
                data.append(url)
                allin.append(data)
            df = pd.DataFrame(allin, columns=names)
            df.to_csv("data.csv", index=False, encoding="utf-8")


    urls = ['https://www2.daad.de/deutschland/studienangebote/international-programmes/en/detail/4722/',
            'https://www2.daad.de/deutschland/studienangebote/international-programmes/en/detail/6318/']
    Main(urls)

 


question - how to find out where the script stores the results - the csv-file. 

can i set the paths in ATOM some how some way - are there some options to do this!?


btw:  very interesting without the encoding = "utf-8" in the line   df.to_csv("data.csv", index=False, encoding="utf-8") i have errors since ihave UnicodeEncodeError, seems that my system default encoding isn't utf-8, therefor, 



guessing:  i guess that i set up the machine /ATOM badly … - any and all help greatly appreciated. - 

 

 

    Traceback (most recent call last):
      File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 25, in <module>
        Main(urls)
      File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 20, in Main
        df.to_csv("data.csv", index=False)
      File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 3020, in to_csv
        formatter.save()
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 172, in save
        self._save()
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 288, in _save
        self._save_chunk(start_i, end_i)
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 315, in _save_chunk
        self.cols, self.writer)
      File "pandas/_libs/writers.pyx", line 75, in pandas._libs.writers.write_csv_rows
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 39: ordinal not in range(128)
    [Finished in 3.134s]

 

 

with the correct encoding the script runs very well python - daad_studienangebote_url_liste.py:21

 

i get back this result in the ATOM -.. 
 

`[Finished in 5.461s]`

 

but there remain two little questions: 

 

a. how ot set the default encoding in ATOM !? 
b. how - and where set the paths in ATOM !? 


love to hear from you 

  • 0

Dear fellows,

 

Regarding the issues: 

 

a. how ot set the default encoding in ATOM !? 
b. how - and where set the paths in ATOM !? 

 

i will digg deeper into all that

 

 

for a. i guess that the solution will be this here - a solver for the default encoding.

atom-default-encoding package:

 

 

atom-default-encoding package

 

see the link: https://atom.io/packages/default-encoding

 

image.thumb.png.d1ed03f32606ad6da0aeb58b6f35740e.png

 

what it does: Specify default encodings in config for a specific scope selector. If no config default is found, try to autodetect encoding.

 

 

 

for b. regarding the setup of python in Atom - and for the question of where the system saves the data - i found out this - hope this may help others too:

 

 

 

above all  - stay healthy - and all the best to  you both!!! 

 

have a great day.

Edited by tarifa

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Apple warns Australia against joining EU in mandating iPhone app sideloading by David Uzondu Apple has issued a warning to Australia, essentially telling the country not to follow the European Union's lead in making iPhone app sideloading a requirement. This communication comes as the Australian federal government considers new rules that could force Apple to open up its iOS ecosystem, much like what happened in Europe with recent legislation. Since iOS 17.4 and iPadOS 18, users in the EU have been able to get apps from outside the official App Store, a direct consequence of the DMA designating Apple as a "gatekeeper". The Australian government floated a proposal in a paper released late last year. The paper suggested "designating" digital platforms like Apple's App Store. Being designated this way means these platforms would have to follow new rules intended to keep them from limiting competition. The government pointed to Apple's in-app payment system, which usually comes with a commission, and the lack of sideloading as likely targets for regulation. Right now, apps like Netflix and Spotify can't let users subscribe through their iOS apps without giving Apple a big cut, and they're not even allowed to tell users where to find a better deal. Apple, in its response to this Australian paper, stated that Australia should not use the EU's Digital Markets Act "as a blueprint". The company's core argument is that the changes mandated by the EU's DMA, which came into full effect in March 2024, introduce serious security and privacy risks for users. Apple claims that allowing sideloading and alternative app stores effectively opens the door for malware, fraud, scams, and other harmful content. The tech company also highlighted specific concerns from its European experience, alleging that its compliance there has led to users being able to install pornography apps and apps that facilitate copyright infringement, things its curated App Store aims to prevent. Apple maintains that its current review process is vital for user protection, and that its often criticized 30% commission applies mainly to the highest earning apps, with most developers paying a lower 15% rate or nothing. It is worth noting that Apple's implementation of DMA requirements in the EU, which includes a "Core Technology Fee" for apps distributed outside its store, has already drawn scrutiny from European Commission officials who question if these measures truly comply with the DMA's idea of keeping the market fair. The Australian government has not yet detailed its next steps in this process, and the Treasury still needs to publish the full submissions to its proposal paper, including Apple's complete arguments. Source: The Guardian
    • Oh the Chinese crybabies who couldn't accept the fact that they lost GOTY to Astro Bot? Not interested
    • Download this SQL Essentials For Dummies eBook (worth $10) for free by Steven Parker FOR DUMMIES is a trademark of John Wiley & Sons, Inc. A right-to-the-point guide on all the key topics of SQL programming SQL Essentials For Dummies is your quick reference to all the core concepts of SQL—a valuable common standard language used in relational databases. This useful guide is straightforward—with no excess review, wordy explanations, or fluff—so you get what you need, fast. Great for a brush-up on the basics or as an everyday desk reference, this book is one you can rely on. Strengthen your understanding of the basics of SQL Review what you've already learned or pick up key skills Use SQL to create, manipulate, and control relational databases Jog your memory on the essentials as you work and get clear answers to your questions Perfect for supplementing classroom learning, reviewing for a certification, and staying knowledgeable on the job, SQL Essentials For Dummies is the convenient, direct, and digestible reference you've been looking for. Claim your complimentary eBook worth $10 for free, before the offer ends on June 17. How to get it Please ensure you read the terms and conditions to claim this offer. Complete and verifiable information is required in order to receive this free offer. If you have previously made use of these free offers, you will not need to re-register. While supplies last! Download the SQL Essentials For Dummies eBook (worth $10) for free Offered by Wiley, view other free resources The below offers are also available for free for a limited time: Winxvideo AI V3.0 Lifetime License for PC ($69.95 Value) FREE – Expires 6/8 Aiarty Image Enhancer for PC/Mac ($85 Value) FREE – Expires 6/8 Solutions Architect's Handbook, Third Edition ($42.99 Value) FREE – Expires 6/10 AI and Innovation ($21 Value) FREE – Expires 6/11 Unruly: Fighting Back when Politics, AI, and Law Upend [...] ($18 Value) FREE - Expires 6/17 SQL Essentials For Dummies ($10 Value) FREE – Expires 6/17 Continuous Testing, Quality, Security, and Feedback ($27.99 Value) FREE – Expires 6/18 VideoProc Converter AI v7.5 for FREE (worth $78.90) – Expires 6/18 Macxvideo AI ($39.95 Value) Free for a Limited Time – Expires 6/22 The Ultimate Linux Newbie Guide – Featured Free content Python Notes for Professionals – Featured Free content Learn Linux in 5 Days – Featured Free content Quick Reference Guide for Cybersecurity – Featured Free content We post these because we earn commission on each lead so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. Other ways to support Neowin The above deal not doing it for you, but still want to help? Check out the links below. Check out our partner software in the Neowin Store Buy a T-shirt at Neowin's Threadsquad Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: An account at Neowin Deals is required to participate in any deals powered by our affiliate, StackCommerce. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through the branded deals site.
    • No one is surprised. It goes both ways. Warhammer remake is not on the PS5, but Xbox/PC and Game Pass day 1 and it is NOT a Microsoft owned game (Sega). 100% Microsoft money deal. Timed of course. Sega wins because they get the Microsoft money now then when the deal ends they get the much larger PS audience to make money from. As far as Black Myth is concerned, the Chinese gaming platform market is very much PC then PS then everything else. Consoles were banned in China for years, then allowed and the PS is the console of choice. The release of Black Myth actually saw a PS5 console sale spike because of Chinese gamer's buying PS5's just to play this game. With the ever shrinking Xbox console market I can see a point where 3rd party games try to get Sony exclusive money because the ROI for Xbox console versions of those games is a shrinking endeavor.
  • Recent Achievements

    • One Month Later
      MoyaM earned a badge
      One Month Later
    • One Month Later
      qology earned a badge
      One Month Later
    • One Year In
      Frinco90 earned a badge
      One Year In
    • Apprentice
      Frinco90 went up a rank
      Apprentice
    • Week One Done
      theevergreentree earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      448
    2. 2
      +FloatingFatMan
      247
    3. 3
      snowy owl
      232
    4. 4
      ATLien_0
      202
    5. 5
      Xenon
      146
  • Tell a friend

    Love Neowin? Tell a friend!