« first day (1982 days earlier)      last day (2983 days later) » 

11:49 AM
Is there anyone here who uses gscan2pdf?
 
12:36 PM
$ env -i sudo -E printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LOGNAME=root
USER=root
USERNAME=root
TERM=unknown
SUDO_COMMAND=/usr/bin/printenv
SUDO_USER=pandya
SUDO_UID=1000
SUDO_GID=1000
 
hi @Pandya . thanks and that is exactly what I get myself
another way to look at the sudo-caused-env-polution is diff <(env -i sudo -E /bin/printenv) <(env -i /bin/printenv) -y
 
Hmm... env -i printenv is clean right?
 
which in my case yields LOGNAME=root <
USER=root <
USERNAME=root <
SHELL=/bin/bash <
TERM=unknown <
PATH=/usr/bin:/bin:/usr/sbin:/sbin <
SUDO_COMMAND=/bin/printenv <
SUDO_USER=user <
SUDO_UID=1000 <
SUDO_GID=1000 <
exactly ! printenv called directly after env -i is clean
 
sudo -E env -i printenv ?
 
I think the answer to the question is merely that an cannot instruct sudo to "keep quiet/ not polute the env", instead one should do as you just say, reverse them. And if you look in the question of mine again, that is what I implied as possible workaround
only I was looking for a way to use sudo directly with a "flat/feature" to mean "clean the environment"
@Pandya btw you got a nice user-profile thing with the info about GNU software free libre. I like libre software.
thank you
 
12:46 PM
Actually I knew about sudo -E from @terdon while facing this question.
@humanityANDpeace You may be interested in deepppandya.wordpress.com/2016/02/19/how-i-do-my-computing
 
 
3 hours later…
3:42 PM
@Pandya Do you write Devnagri online?
 
4:41 PM
I had posted this question in python, but it seems it is more related to an issue at the level of OS. Please kindly check. stackoverflow.com/questions/35791965/…
 
4:55 PM
@AbhishekBhatia These sorts of errors are usually easy to resolve.
Where are you trying to write to?
 
A database
@FaheemMitha I can't comprehend the reason of the error though. I am using sqlite to create a database and write to it.
 
@AbhishekBhatia A sqlite database?
And where is the sqlite file located?
 
sry a sqlalchemy one
It is located in the same folder as the main flask python script /var/www/FlaskApps/note_app
 
5:31 PM
@AbhishekBhatia Well, what are the permissions of that directory? ls -lah at the top level of the directory, please.
 
ubuntu@ip-172-31-38-0:/var/www/FlaskApps$ ls -lah
total 16K
drwxrwxrwx 3 root root 4.0K Mar  4 07:41 .
drwxr-xr-x 4 root root 4.0K Mar  4 07:12 ..
-rwxrwxrwx 1 root root  264 Mar  4 07:41 FlaskApps.wsgi
drwxrwxrwx 3 root root 4.0K Mar 13 16:28 note_app
The code and database are in note_app
 
5:47 PM
@AbhishekBhatia Yes, I see.
Hold on. In the subdirectory?
 
ubuntu@ip-172-31-38-0:/var/www/FlaskApps/note_app$ ls -ahl
total 40K
drwxrwxrwx 3 root     root     4.0K Mar 13 16:28 .
drwxrwxrwx 3 root     root     4.0K Mar  4 07:41 ..
drwxr-xr-x 8 root     root     4.0K Mar  4 08:56 .git
-rw-r--r-- 1 root     root       11 Mar  4 07:21 .gitignore
-rwxr-xr-x 1 root     root     2.0K Mar  4 08:56 home.py
-rw-r--r-- 1 www-data www-data 2.5K Mar 13 16:28 home.pyc
-rwxrwxrwx 1 root     root      728 Mar  4 07:46 models.py
-rw-r--r-- 1 www-data www-data 1.2K Mar 13 16:28 models.pyc
 
Ok, so do ls -lahR then.
 
Though the database is nvr created in the noteapp, due to permission error.
 
@AbhishekBhatia Oh, I meant one level up. But the db file is supposed to be created in note_app, but it not created?
Ok, try switching to www-data and do touch foo inside note_app.
 
I am not able to switch. It asks password. I enter nothing and press Enter(assuming www-data was created without a password).
ubuntu@ip-172-31-38-0:~$ su www-data
Password:
su: Authentication failure
 
6:03 PM
@AbhishekBhatia No, switch to root first. It doesn't ask for a password from root.
 
ubuntu@ip-172-31-38-0:~$ sudo -i
root@ip-172-31-38-0:~# su www-data
This account is currently not available.
I tried to stop apache and try but doesn't work still.
root@ip-172-31-38-0:~# /etc/init.d/apache2 stop
 * Stopping web server apache2                                                                                                                            *
root@ip-172-31-38-0:~# su www-data
This account is currently not available.
 
@AbhishekBhatia Ok, I get the same thing. Let me check why it doesn't work.
 
6:20 PM
15
A: "This account is currently not available" error when trying to ssh

kraxorYou're getting the This account is currently not available. error because the shell for the user www-data is set to /usr/sbin/nologin, and it's set for a very good reason. You should not log in as www-data, it's a special user/group used by the web server, not intended for regular shell use. EDI...

 
Ok, that user is set to not allow logins.
Sorry for wasting your time.
Ok, try su -s /bin/sh www-data. That works here.
 
no issues, weird it is able to create a file
$ ls
FlaskApps.wsgi	note_app
$ cd note_app
$ touch check_perm.txt
$ ls
check_perm.txt	home.py  home.pyc  models.py  models.pyc  out.txt  README.md  restart_server.sh
$
 
@AbhishekBhatia Hmm. Ok, not a file level permission issue then.
Are you sure it is trying to create the sql file where you think it is?
Add an absolute path for the sqlite db.
 
6:50 PM
yeah it works on local machine(tried without apache).
The absolute path makes no difference.
that's weird.
engine = sqlite.create_engine('sqlite:////var/www/FlaskApps/note_app/userslogininfo.db')
 
@AbhishekBhatia What is weird?
 
Can't understand the issue. Everything seems fine.
 
Hey @FaheemMitha do you understand Hindi?
 
7:06 PM
What does this mean (probably offensive but I need to make sure)? (I don't know if it's actually Hindi, just guessing from context) “Yar msla keya ha Tujy? bara beghrat ha tu kamina na hoto”
 
@Gilles Rudimentary Hindi, yes.
@Gilles Context, please? What's the Devnagri version?
 
@FaheemMitha it's all I have, unfortunately
 
The first sentence is what's your problem dude?
 
@AbhishekBhatia Ok. Try putting the sqlite db in other locations. Up one level, up two levels. Are you sure Apache has access to that directory?
@AbhishekBhatia What's it in Devnagri? I'm having trouble parsing.
 
If I type it into Google Translate, it tells me that's “यार मसला किया है तुजय? बड़ा बेघरत है तू कमीना न होतो”, but I have no idea whether it got the transliteration right. It tells me the translation is “Man's Tujay issue? You are not averse Creep big Begrt”, which is not helpful.
 
7:12 PM
“यार मसला किया है तुजय?" is definitely correct except for the second word.
"यार" is a colloquial means of address. Similar to dude, as Abhishek says.
"किया है तुजय" means "have you done?".
Actually, could "Yar" be "Kya"?
Actually, I don't think तुजय is right, either.
तुझे is probably correct.
 
the second sentence is something weird, maybe .."Very shameless are you if not rascal. "
 
@AbhishekBhatia thanks, that was helpful
 
It seems more urdu than hindi I think.
 
7:42 PM
@FaheemMitha I changed the ownership, still doesn't work.
ubuntu@ip-172-31-38-0:/var/www/FlaskApps$ ls -la
total 20
drwxrwxrwx 4 root     root   4096 Mar 13 18:41 .
drwxr-xr-x 4 root     root   4096 Mar  4 07:12 ..
-rwxrwxrwx 1 root     root    264 Mar  4 07:41 FlaskApps.wsgi
drwxrwxrwx 3 www-data ubuntu 4096 Mar 13 19:37 note_app
drwxrwxrwx 3 root     root   4096 Mar 13 18:39 note_app_old
 
@AbhishekBhatia I'm unclear what you were trying to do there.
 
changed the ownership to the apache user sudo chown www-data note_app
 
@AbhishekBhatia I don't think your issue is a permission issue at the filesystem level.
 
8:44 PM
This is the full log. I can't understand what is going on? pastebin.com/CzEqCFHR
 
@AbhishekBhatia Clickable link, please.
You didn't mention this error before. Why not?
 
> Target WSGI script '/var/www/FlaskApps/FlaskApps.wsgi' cannot be loaded as Python module.
Try loading it manually into the Python interpreter.
What does "FlaskApps.wsgi" look like?
 
   $ cat FlaskApps.wsgi
    #! /root/anaconda2/bin/python
    import sys
    import logging
    logging.basicConfig(stream=sys.stderr)
    sys.path.insert(0,"/var/www/FlaskApps/notepad_app/")

    # home points to the home.py file
    from home import app as application
    application.secret_key = "somesecretsessionkey"
 
9:03 PM
Good grief, what is #! /root/anaconda2/bin/python?
@AbhishekBhatia Check if you can import that as a Python module
@AbhishekBhatia Where is home.py located?
Ok, another strategy. Replace "FlaskApps.wsgi" with something trivial and see if it loads.
BTW, in your question you have note_app, but in "FlaskApps.wsgi" you have notepad_app.
 
I removed #! /root/anaconda2/bin/python, it is just another python interpreter.
by importing you mean it isn't a .py file. Though it runs when called from interpreter
Sry, fixed that it is notepad_app only.
 
@AbhishekBhatia you probably don't need a hash-bang there anyway.
 
9:26 PM
yeah.
ubuntu@ip-172-31-38-0:/var/www/FlaskApps$ tree
.
├── FlaskApps.wsgi
└── notepad_app
    ├── clean_log.sh
    ├── database
    ├── home.py
    ├── home.pyc
    ├── models.py
    ├── models.pyc
    ├── print_log.sh
    ├── README.md
    └── restart.sh
 
9:37 PM
Try replacing the wsgi file with something trivial. See if it loads then.
 
ubuntu@ip-171-31-38-0:/var/www/FlaskApps$ python FlaskApps.wsgi
Traceback (most recent call last):
  File "FlaskApps.wsgi", line 7, in <module>
    from home import app as application
  File "/var/www/FlaskApps/notepad_app/home.py", line 4, in <module>
    from models import UsersLoginInfo,Base
  File "/var/www/FlaskApps/notepad_app/models.py", line 29, in <module>
    Base.metadata.create_all(engine)
  File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3695, in create_all
@FaheemMitha check the above
 
@AbhishekBhatia Well, clearly:
from home import app as application
is your problem.
No, hang on.
You are using sys.path.insert(0,"/var/www/FlaskApps/notepad_app/"), right.
 
yeah. It should be in path.
 
@AbhishekBhatia Some reason you aren't just using append?
 
9:52 PM
Well, not really but I don't think that makes a difference.
It is mostly to avoid name conflicts. Thus, inserting it in the start instead of the end.
 
@AbhishekBhatia Ok. I'd put it at the end myself, though.
@AbhishekBhatia Sorry, I must be suffering from lack of sleep. The end of a Python traceback shows the problem.
I suggest adding some debugging code. Check what location the sqlite is trying to open.
Also, check for circular references. They can be a bugger.
 
10:17 PM
@FaheemMitha Thanks the help so much!!. I tried to use absolute paths for location of sqlite and that fixed it.
Phew
 
@AbhishekBhatia I thought you tried that already.
@AbhishekBhatia I think I deserve that bounty.
I added a brief answer. If you give me more details, I'll add them.
 
I kind of missed it somehow.
yeah.
ok bye. thanks again.
 
@AbhishekBhatia Ok. How about the bounty? I don't know how it works. I don't think I've ever tried for a bounty.
I only looked at this one because you came here.
Sorry I was not very clueful. But it's been years since I used SQLA, and I wasn't honestly paying that much attention.
Ah, I see I got the bounty. Thanks.
 

« first day (1982 days earlier)      last day (2983 days later) »