• 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

    • I’ve just paid £290/$390 for a 4TB Samsung 990 Pro for my PS5 Pro so it’s not too far from the going rate. Microsoft should definitely copy Sony and let users buy their own SSD in their next consoles rather than this proprietary stuff. I paid £374/$505 for the 2TB Seagate card for my Series X a few years ago so it’s not exactly over priced. 4TB of NVMe storage ain’t cheap!
    • The EU regulations force companies to respect users privacy, choice and data. Something all tech companies have abused to the hilt and would continue to do so if it wasn’t for important legislation and laws the EU brought in, which have been adopted elsewhere around the world. The EU can be a nuisance, but they actually do more good than harm. Forcing Apple, Google, Microsoft etc to make changes hasn’t negatively impacted anyone apart from their financials as they aren’t free to pillage our data like they once were, unless they explicitly provide options to obtain consent.
    • Windows 10 Enterprise IoT LTSC will continue getting updates until January 2032. I would expect support from most programs to continue until then. Firefox still supports Windows 7 (until the end of August), which will be just over 16 years since release. Windows 10 will be of a very similar age in January 2032. I'm sure some things like games will move on earlier, but I imagine a Windows 10 machine will be safe and usable for a long time to come yet, despite the pressure and fearmongering from those who stand to gain from selling you a new PC.
    • Refined dock and bug fixes land in latest Elementary OS 8 updates by David Uzondu If you're running Elementary OS 8, there's a new round of updates available, bringing some neat enhancements, particularly to its signature Dock and the underlying window manager, Gala. If you are not familiar, Elementary OS positions itself as a polished alternative to Windows and macOS. It runs its own custom desktop environment called Pantheon, with Gala handling all the window management magic, like animations and how windows behave. In the new update, the Dock gets some notable new tricks, including the return of a couple of features that old-school Plank (the Dock's foundation) users might remember. For starters, the Dock now shows multiple indicator dots beneath an app icon if you have more than one window open for that application, which is useful for quickly seeing what is running. Plus, if you are dragging something and hover over an app icon in the Dock, it will cycle through that app's open windows, making it easier to drop your item into the right place. You can also now long-press an app icon to bring up its context menu, a nice touch for those who prefer that interaction. The elementary OS team also squashed some bugs related to hide modes and memory usage, keeping things running smoothly. Gala itself recently got a massive update, addressing around 20 reported issues and introducing a brand new Gesture Controller. This means users can now swipe up in the Multitasking View to close windows, a slick and intuitive gesture. App titles are now always shown in Multitasking View, a significant improvement for touchscreen users. Users also get notified when they take a screenshot with a keyboard shortcut, and this notification lets them jump straight to the image in Files. Some other welcome Gala improvements include saving window states on sleep and shutdown, and fixing an annoying bug where menus might only show once. For gamers, a fix for Lutris Flatpak installations causing Gala to crash with GE Proton setups will be a relief, and users of the Postman app will be happy to know that window captures for it are no longer partially rendered. Shifting back to Elementary OS 8, in System Settings, choosing light or dark mode properly snoozes your schedule instead of outright disabling it. The Reduce Motion setting has been expanded to cover a wider array of animations, which is a blessing for folks prone to motion sickness. Hotcorners got some fixes too, and there is a new option to keep them active even when an application is full screen. Other notable updates include added screen reader support for notifications and the shortcut overlay, fixes for Flatpak sandbox issues that affected apps like Steam, and the latest version of GNOME Web, which brought better performance and a redesigned bookmarks sidebar. You can download all these updates by opening System Settings, heading to System, and hitting "Update All."
    • WSCC - Windows System Control Center 10.0.0.8 by Razvan Serea Windows System Control Center is a free, portable program that allows you to install, update, execute and organize the utilities from various system utility suites. WSCC can install and update the supported utilities automatically. Alternatively, WSCC can use the http protocol to download and run the programs. WSCC is portable, installation is not required. Extract the content of the downloaded zip archive to any directory on your computer. Free for personal use. The setup packages and updates are downloaded directly from their author's website! This edition of WSCC supports the following utility suites: Windows Sysinternals Suite (including support for "Sysinternals Live" service) NirSoft Utilities Mitec and more... WSCC - Windows System Control Center 10.0.0.8 changelog: Update Manager: scheduled updates will run even if WSCC is already running minor user interface improvements Download: WSCC (64-bit) | 6.9 MB (Free for personal use) Download: WSCC (32-bit) | 6.2 MB View: WSCC Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Enthusiast
      Epaminombas went up a rank
      Enthusiast
    • Posting Machine
      Fiza Ali earned a badge
      Posting Machine
    • One Year In
      WaynesWorld earned a badge
      One Year In
    • First Post
      chriskinney317 earned a badge
      First Post
    • Week One Done
      Nullun earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      186
    2. 2
      snowy owl
      131
    3. 3
      ATLien_0
      129
    4. 4
      Xenon
      121
    5. 5
      +Edouard
      91
  • Tell a friend

    Love Neowin? Tell a friend!